[ABNF] Add initial output grammar.

This is for the current simplified version of Leo. When the main function is
executed, it returns a value. According to this grammar, the output (i.e.
`.out`) file contains a single literal, which describes the output value,
preceded by an `[output]` title. This may be extended in the future.
This commit is contained in:
Alessandro Coglio 2022-05-24 23:05:14 -07:00
parent bafb4b85e8
commit b26ed8e2ef
2 changed files with 56 additions and 0 deletions

View File

@ -963,4 +963,45 @@ Go to: _[input-title](#user-content-input-title)_;
<a name="input-file"></a>
```abnf
input-file = *input-section
```
--------
Output Grammar
--------------
<a name="output-expression"></a>
```abnf
output-expression = literal
```
Go to: _[literal](#user-content-literal)_;
<a name="output-item"></a>
```abnf
output-item = output-expression ";"
```
Go to: _[output-expression](#user-content-output-expression)_;
<a name="output-title"></a>
```abnf
output-title = "[" %s"output" "]"
```
<a name="output-section"></a>
```abnf
output-section = output-title output-item
```
Go to: _[output-item](#user-content-output-item), [output-title](#user-content-output-title)_;
<a name="output-file"></a>
```abnf
output-file = output-section

View File

@ -374,3 +374,18 @@ input-title = "[" ( %s"public" / %s"private" / %s"constant" / %s"const" ) "]"
input-section = input-title *input-item
input-file = *input-section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Output Grammar
; --------------
output-expression = literal
output-item = output-expression ";"
output-title = "[" %s"output" "]"
output-section = output-title output-item
output-file = output-section