diff options
author | Melody Horn <melody@boringcactus.com> | 2020-10-13 15:46:25 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2020-10-13 15:46:25 -0600 |
commit | e57941f5f43507c275623bc82d4f5f93103876ca (patch) | |
tree | 38f8cc1987b7fc9dd79aba71524e0222b20a747f | |
parent | 22a94474f8cf8a4e34eacbce3ef58ccdd8949f2f (diff) | |
download | spec-e57941f5f43507c275623bc82d4f5f93103876ca.tar.gz spec-e57941f5f43507c275623bc82d4f5f93103876ca.zip |
test tree-based PEG layout
-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 | |