diff options
-rw-r--r-- | syntax.md | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -21,7 +21,7 @@ Tokens are separated by either *whitespace* or a *comment*. ## Keywords -A *keyword* is one of the following 28 literal words: +A *keyword* is one of the following literal words: - `bool` - `break` - `case` @@ -46,7 +46,6 @@ A *keyword* is one of the following 28 literal words: - `sizeof` - `struct` - `switch` -- `typedef` - `unsigned` - `void` - `while` @@ -157,3 +156,15 @@ A *comment* can be either a *line comment* or a *block comment*. A *line comment* begins with the characters `//` if they occur outside of a string literal or comment, and ends with a newline character U+000A. A *block comment* begins with the characters `/*` if they occur outside of a string literal or comment, and ends with the characters `*/`. + +# Parsing + +The syntax of Crowbar is given as a [parsing expression grammar](https://en.wikipedia.org/wiki/Parsing_expression_grammar): + +| Syntax Element | | Parsing Expression | +|:-----------------|:-:|:-------------------------| +|ImplementationFile| ← |ImplementationFileElement*| +|HeaderFile | ← |HeaderFileElement* | +|HeaderFileElement | ← |IncludeStatement | +| | / |TypeDeclaration | +| | / |FunctionDeclaration | |