summary refs log tree commit diff
path: root/grammar.ebnf
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-06 12:00:30 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-06 12:00:30 +0100
commit2ccedaa09f7da6d4975164e6048ff6caa631c3e6 (patch)
treeddb8e9f15be918e1823495ef6a4f7dda1e12d7ba /grammar.ebnf
parentexamples: add another example (diff)
downloadinterpreter-2ccedaa09f7da6d4975164e6048ff6caa631c3e6.tar.gz
interpreter-2ccedaa09f7da6d4975164e6048ff6caa631c3e6.tar.bz2
interpreter-2ccedaa09f7da6d4975164e6048ff6caa631c3e6.zip
Add language grammar
Diffstat (limited to 'grammar.ebnf')
-rw-r--r--grammar.ebnf9
1 files changed, 9 insertions, 0 deletions
diff --git a/grammar.ebnf b/grammar.ebnf
new file mode 100644
index 0000000..cc087fe
--- /dev/null
+++ b/grammar.ebnf
@@ -0,0 +1,9 @@
+Program ::= Statement+
+
+Statement ::= (VariableStatement | PrintStatement) SEMICOLON
+
+VariableStatement ::= ("let" IDENTIFIER | IDENTIFIER) EQUALS Expression
+
+PrintStatement :== PRINT LPAREN Expression RPAREN
+
+Expression :== NUMBER | IDENTIFIER | LPAREN Expression RPAREN