comparison docs/examples/example-1.pseudocode @ 151:4a8c122725b0

Move all the example files to "examples/"
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 07 May 2026 16:12:15 +0200
parents docs/example-1.pseudocode@4acf578ae93f
children d6b66d02fb86
comparison
equal deleted inserted replaced
150:4acf578ae93f 151:4a8c122725b0
1 // -*- coding: utf-8; indent-tabs-mode: nil -*-
2 \PROGRAM {The Pseudocode Lexer} \IS
3
4 /*
5 * The program is here, but it also could be an \ALGORITHM
6 *
7 * /* YES! Nested multi-line comments work! */
8 */
9
10 \PROC {A Procedure name} \IS
11 \TBLOCK {A text block 1}
12 \TBLOCK {A text block 2 with a nested expression: \expr{flag is FALSE}}
13 \BLOCK {
14 \REMARK A remark on its own line within a "BLOCK"
15 }
16 \END-PROC {A Procedure name}
17
18 \FUNCTION{A Function with {escaped\} text} \IS
19 a and b xor (c in d) \rem this is another remark
20 \block {foo bar}
21
22 \IF a is nil \THEN
23 \text{Set something}
24 \ELSEIF
25 \text{Set some other thing}
26 \END-IF
27 \END FUNCTION{A Function with {escaped\} text}
28
29 \CLASS{A Class} \IS
30 // This is a one-line comment
31 a and b xor (c in d) \rem this is another remark
32
33 # This is another one-line comment
34
35 (* Here is a "block" of expressions.
36 A block has a leading symbol. *)
37 \block {foo
38 bar}
39 \block{a 1.2 {x in X\} c}
40 (* Analogous there is a variant that is in text-mode by default.
41 It has an other leading symbol. *)
42 \tstate{We will compute next \expr{a xor b or (\text{set} X is Empty)} \rem without c!
43 or multiply it the other way round}
44
45 \tstate{foo bar \rem A remark within a text statement until LF!
46 nextfoo nextbar
47 nextnextfoo nextnextbar}
48 \ENDCLASS{A Class}
49
50 @A_XXX
51 FOO BAR
52 \ENDPROG