History

document spacing in il reference

Quentin Carbonneaux committed 4 years ago

Commit fb742ec1 parent 6cd97971 file · +30 −14Browse files

Unified · Split

doc/il.txt+30−14
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 * <@ Input Files >
1212 * <@ BNF Notation >
1313 * <@ Sigils >
14+ * <@ Spaces >
1415 2. <@ Types >
1516 * <@ Simple Types >
1617 * <@ Subtyping >
@@ -105,6 +106,16 @@ scope and nature of identifiers. · 88 unmodified lines
105106 In this BNF syntax, we use `?IDENT` to designate an identifier
106107 starting with the sigil `?`.
107108
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+
108119 - 2. Types
109120 ----------
110121
@@ -202,9 +213,9 @@ constants by the linker. · 91 unmodified lines
202213
203214 `bnf
204215 LINKAGE :=
205− 'export'
206− | 'section' SECNAME
207− | 'section' SECNAME SECFLAGS
216+ 'export' '\n'*
217+ | 'section' SECNAME '\n'*
218+ | 'section' SECNAME SECFLAGS '\n'*
208219
209220 SECNAME := '"' .... '"'
210221 SECFLAGS := '"' .... '"'
@@ -296,7 +307,8 @@ their size between curly braces. · 85 unmodified lines
296307
297308 `bnf
298309 DATADEF :=
299− LINKAGE* 'data' $IDENT '=' ['align' NUMBER]
310+ LINKAGE*
311+ 'data' $IDENT '=' ['align' NUMBER]
300312 '{'
301313 ( EXTTY DATAITEM+
302314 | 'z' NUMBER ),
@@ -354,8 +366,9 @@ Here are various examples of data definitions. · 51 unmodified lines
354366
355367 `bnf
356368 FUNCDEF :=
357− LINKAGE* 'function' [ABITY] $IDENT '(' (PARAM), ')'
358− '{'
369+ LINKAGE*
370+ 'function' [ABITY] $IDENT '(' (PARAM), ')' '\n'*
371+ '{' '\n'+
359372 BLOCK+
360373 '}'
361374
@@ -440,25 +453,28 @@ connected using jump instructions. · 78 unmodified lines
440453
441454 `bnf
442455 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'+
447463
448464 All blocks have a name that is specified by a label at
449465 their beginning. Then follows a sequence of instructions
450466 that have "fall-through" flow. Finally one jump terminates
451467 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
453469 further below.
454470
455471 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
458474 at the beginning of the function.
459475
460476 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
462478 will be automatically added by the parser. For example
463479 the start block in the example below jumps directly
464480 to the loop block.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t