Unified · Split
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | * <@ Input Files > |
| 12 | 12 | * <@ BNF Notation > |
| 13 | 13 | * <@ Sigils > |
| 14 | + * <@ Spaces > | |
| 14 | 15 | 2. <@ Types > |
| 15 | 16 | * <@ Simple Types > |
| 16 | 17 | * <@ Subtyping > |
| @@ -105,6 +106,16 @@ scope and nature of identifiers. · 88 unmodified lines | ||
| 105 | 106 | In this BNF syntax, we use `?IDENT` to designate an identifier |
| 106 | 107 | starting with the sigil `?`. |
| 107 | 108 | |
| 109 | +~ Spaces | |
| 110 | +~~~~~~~~ | |
| 111 | + | |
| 112 | +Individual tokens in IL files must be separated by one or | |
| 113 | +more spacing characters. Both spaces and tabs are recognized | |
| 114 | +as spacing characters. In data and type definitions, newlines | |
| 115 | +can also be used as spaces to prevent overly long lines. When | |
| 116 | +exactly one of two consecutive tokens is a symbol (for example | |
| 117 | +`,` or `=` or `{`), space may be omitted. | |
| 118 | + | |
| 108 | 119 | - 2. Types |
| 109 | 120 | ---------- |
| 110 | 121 | |
| @@ -202,9 +213,9 @@ constants by the linker. · 91 unmodified lines | ||
| 202 | 213 | |
| 203 | 214 | `bnf |
| 204 | 215 | LINKAGE := |
| 205 | − 'export' | |
| 206 | − | 'section' SECNAME | |
| 207 | − | 'section' SECNAME SECFLAGS | |
| 216 | + 'export' '\n'* | |
| 217 | + | 'section' SECNAME '\n'* | |
| 218 | + | 'section' SECNAME SECFLAGS '\n'* | |
| 208 | 219 | |
| 209 | 220 | SECNAME := '"' .... '"' |
| 210 | 221 | SECFLAGS := '"' .... '"' |
| @@ -296,7 +307,8 @@ their size between curly braces. · 85 unmodified lines | ||
| 296 | 307 | |
| 297 | 308 | `bnf |
| 298 | 309 | DATADEF := |
| 299 | − LINKAGE* 'data' $IDENT '=' ['align' NUMBER] | |
| 310 | + LINKAGE* | |
| 311 | + 'data' $IDENT '=' ['align' NUMBER] | |
| 300 | 312 | '{' |
| 301 | 313 | ( EXTTY DATAITEM+ |
| 302 | 314 | | 'z' NUMBER ), |
| @@ -354,8 +366,9 @@ Here are various examples of data definitions. · 51 unmodified lines | ||
| 354 | 366 | |
| 355 | 367 | `bnf |
| 356 | 368 | FUNCDEF := |
| 357 | − LINKAGE* 'function' [ABITY] $IDENT '(' (PARAM), ')' | |
| 358 | − '{' | |
| 369 | + LINKAGE* | |
| 370 | + 'function' [ABITY] $IDENT '(' (PARAM), ')' '\n'* | |
| 371 | + '{' '\n'+ | |
| 359 | 372 | BLOCK+ |
| 360 | 373 | '}' |
| 361 | 374 | |
| @@ -440,25 +453,28 @@ connected using jump instructions. · 78 unmodified lines | ||
| 440 | 453 | |
| 441 | 454 | `bnf |
| 442 | 455 | BLOCK := |
| 443 | − @IDENT # Block label | |
| 444 | − PHI* # Phi instructions | |
| 445 | − INST* # Regular instructions | |
| 446 | − JUMP # Jump or return | |
| 456 | + @IDENT '\n'+ # Block label | |
| 457 | + PHILINE* # Phi instructions | |
| 458 | + INSTLINE* # Regular instructions | |
| 459 | + JUMP '\n'+ # Jump or return | |
| 460 | + | |
| 461 | + PHILINE := PHI '\n'+ | |
| 462 | + INSTLINE := INST '\n'+ | |
| 447 | 463 | |
| 448 | 464 | All blocks have a name that is specified by a label at |
| 449 | 465 | their beginning. Then follows a sequence of instructions |
| 450 | 466 | that have "fall-through" flow. Finally one jump terminates |
| 451 | 467 | the block. The jump can either transfer control to another |
| 452 | −block of the same function or return; they are described | |
| 468 | +block of the same function or return; jumps are described | |
| 453 | 469 | further below. |
| 454 | 470 | |
| 455 | 471 | The first block in a function must not be the target of |
| 456 | −any jump in the program. If this is really needed, | |
| 457 | −the frontend could insert an empty prelude block | |
| 472 | +any jump in the program. If a jump to the function start | |
| 473 | +is needed, the frontend must insert an empty prelude block | |
| 458 | 474 | at the beginning of the function. |
| 459 | 475 | |
| 460 | 476 | When one block jumps to the next block in the IL file, |
| 461 | −it is not necessary to give the jump instruction, it | |
| 477 | +it is not necessary to write the jump instruction, it | |
| 462 | 478 | will be automatically added by the parser. For example |
| 463 | 479 | the start block in the example below jumps directly |
| 464 | 480 | to the loop block. |