about summary refs log tree commit diff
path: root/grammar.ebnf
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-01-06 12:00:30 +0100
committerBaitinq <[email protected]>2025-01-06 12:00:30 +0100
commit5c2ccb41a0df4ba95cb36bfb0c2ddda5237f99ab (patch)
treeddb8e9f15be918e1823495ef6a4f7dda1e12d7ba /grammar.ebnf
parentexamples: add another example (diff)
downloadpry-lang-5c2ccb41a0df4ba95cb36bfb0c2ddda5237f99ab.tar.gz
pry-lang-5c2ccb41a0df4ba95cb36bfb0c2ddda5237f99ab.tar.bz2
pry-lang-5c2ccb41a0df4ba95cb36bfb0c2ddda5237f99ab.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