summaryrefslogtreecommitdiff
path: root/chapter10/docs/10-grammar.md
diff options
context:
space:
mode:
authorThalia Archibald <thalia@archibald.dev>2024-06-21 06:13:09 -0700
committerGitHub <noreply@github.com>2024-06-21 14:13:09 +0100
commite5f4f7b85fbb91a293a7d89d7b85adfbaeeb51f4 (patch)
tree9b6ecc7ef37b1ec7f08efed6f908f478dc551e03 /chapter10/docs/10-grammar.md
parenta749c244bea3e2774d453165cbd18ed52863a8f5 (diff)
downloadSimple-e5f4f7b85fbb91a293a7d89d7b85adfbaeeb51f4.tar.gz
Simple-e5f4f7b85fbb91a293a7d89d7b85adfbaeeb51f4.zip
Format whitespace (#86)
* Trim trailing whitespace * Ensure final new lines * Convert line endings from CRLF to LF * Replace tabs with spaces
Diffstat (limited to 'chapter10/docs/10-grammar.md')
-rw-r--r--chapter10/docs/10-grammar.md24
1 files changed, 12 insertions, 12 deletions
diff --git a/chapter10/docs/10-grammar.md b/chapter10/docs/10-grammar.md
index cb68df3d..01863e7f 100644
--- a/chapter10/docs/10-grammar.md
+++ b/chapter10/docs/10-grammar.md
@@ -11,7 +11,7 @@ statement
: returnStatement
| structDeclaration
| declStatement
- | blockStatment
+ | blockStatment
| expressionStatement
| ifStatement
| whileStatement
@@ -26,7 +26,7 @@ field
fields
: field+
- ;
+ ;
structDeclaration
: 'struct' IDENTIFIER '{' fields '}'
@@ -39,10 +39,10 @@ whileStatement
breakStatement
: 'break' ';'
;
-
+
continueStatement
: 'continue' ';'
- ;
+ ;
ifStatement
: 'if' '(' expression ')' statement ('else' statement)?
@@ -77,15 +77,15 @@ returnStatement
expression
: comparisonExpression
;
-
+
comparisonExpression
: additiveExpression (('==' | '!='| '>'| '<'| '>='| '<=') additiveExpression)*
;
-
+
additiveExpression
- : multiplicativeExpression (('+' | '-') multiplicativeExpression)*
+ : multiplicativeExpression (('+' | '-') multiplicativeExpression)*
;
-
+
multiplicativeExpression
: unaryExpression (('*' | '/') unaryExpression)*
;
@@ -96,7 +96,7 @@ unaryExpression
;
newExpression
- : 'new' IDENTIFIER
+ : 'new' IDENTIFIER
;
fieldExpression
@@ -118,11 +118,11 @@ INTEGER_LITERAL
: [1-9][0-9]*
| [0]
;
-
+
IDENTIFIER
: NON_DIGIT (NON_DIGIT | DIGIT)*
;
-
+
NON_DIGIT: [a-zA-Z_];
DEC_DIGIT: [0-9];
-``` \ No newline at end of file
+```