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