aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2020-10-13 15:46:25 -0600
committerMelody Horn <melody@boringcactus.com>2020-10-13 15:46:25 -0600
commite57941f5f43507c275623bc82d4f5f93103876ca (patch)
tree38f8cc1987b7fc9dd79aba71524e0222b20a747f
parent22a94474f8cf8a4e34eacbce3ef58ccdd8949f2f (diff)
downloadspec-e57941f5f43507c275623bc82d4f5f93103876ca.tar.gz
spec-e57941f5f43507c275623bc82d4f5f93103876ca.zip
test tree-based PEG layout
-rw-r--r--syntax.md15
1 files changed, 13 insertions, 2 deletions
diff --git a/syntax.md b/syntax.md
index 1555409..c0b043f 100644
--- a/syntax.md
+++ b/syntax.md
@@ -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 |