From dc43949cf72cf584b3df25b0d4a191ef3197a04a Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 16 Mar 2026 11:40:00 +0100 Subject: [PATCH] Mon 16 Mar 11:39:34 CET 2026 --- doc/Untitled.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 doc/Untitled.md diff --git a/doc/Untitled.md b/doc/Untitled.md new file mode 100644 index 0000000..5252ff1 --- /dev/null +++ b/doc/Untitled.md @@ -0,0 +1,51 @@ +## Program Control + +### Statement block + +A statement block binds single statements enclosed in a curled paranthesis pair. +``` +{ Φ Φ Φ .. } +``` + +### Conditional Branches + +There is only a `if then else` statement branching to conditional statements. Conditional statements can be replaced by statement blocks, too. + +| Statement | Description | +|:--|:--| +| `if ε:Φ:Φ:.. ` | If expression ε is true (not equal 0), then the following line statements are executed. | +| `if ε then Φ:Φ:.. ` | If expression ε is true (not equal 0), then the following line statements are executed. | +| `if ε { Φ }` | If expression ε is true (not equal 0), then the following block statement is executed. | +| `if ε then { Φ }` | If expression ε is true (not equal 0), then the following block statement is executed. | +| `if ε Φ1 else Φ2` | If expression ε is true (not equal 0), then the following statement Φ1 is executed else Φ2. | +| `if ε { Φ1 } else { Φ1 }` | If expression ε is true (not equal 0), then the following block statement Φ1 is executed, else Φ2. | + + +### Loops + +There are conuting, conditional, and unconditional loops. Body statements can be replaced by statement blocks, too. + +| Statement | Description | F-Stack Frame | +|:--|:--| +| `for i = a,b: Φ: Φ: ..` | Counting loop starting with *i*=*a* and terminating with i=b. The default increment value is one. | F(b,control address,end address,'F') | +| `for i = a,b do Φ: Φ: ..` | Counting loop starting with *i*=*a* and terminating with i=b. The default increment value is one. | F(b,control address,end address,'F') | +| `for i = a,b,s: Φ: Φ: ..` | Counting loop starting with *i*=*a* and looping as long as *i*<=*b*. The increment value (step size) is *s*. | F(b,step,control address,end address,'F') | +| `while ε: Φ: Φ: ..` | Conditional loop checking the expression ε at start. | F(start address,end address, 'W') | +| `while ε do Φ: Φ: ..` | Conditional loop checking the expression ε at start. | F(start address,end address, 'W') | +| `do Φ: Φ: .. while ε` | Conditional loop checking the expression ε at end. | F(start address,end address, 'D') | +| `repeat Φ` | Endless (service) loop, but breakable. | F(start address,end address, 'D') | +| `break` | Leave current (innerst) loop | - | +| `continue` | Branch to end of loop body (starting new loop iteration) | - | + +### Functions and Procedures + +| Statement | Description | F-Stack Frame | +|:--|:--| +| `proc pname { Φ } ` | Defines a procedure (no arguments, no return value) | - | +| `func fname(a,b,c) { Φ } ` | Defines a function with arguments (a,b,c) and a return value. | - | +| `return` | Return from procedure call (no return value) | - | +| `return ε` | Return from function call with return value ε | - | +| `call pname` | Call procedure | F() | +| `call fname(ε,..)` | Call function without return value | F() | +| `x=call fname(ε,..)` | Call function (in expression) with return value | F() | +