summaryrefslogtreecommitdiff
path: root/grammar.txt
diff options
context:
space:
mode:
authorElizabeth Alexander Hunt <me@liz.coffee>2026-08-03 09:18:06 -0700
committerElizabeth Alexander Hunt <me@liz.coffee>2026-08-03 09:18:06 -0700
commitfc2844ae88c85f082b47630b92a55bca3ff285b1 (patch)
tree4a6cca7892459ece38bf72b61352d4fc1bb239e0 /grammar.txt
downloadgock-fc2844ae88c85f082b47630b92a55bca3ff285b1.tar.gz
gock-fc2844ae88c85f082b47630b92a55bca3ff285b1.zip
Init
Diffstat (limited to 'grammar.txt')
-rw-r--r--grammar.txt29
1 files changed, 29 insertions, 0 deletions
diff --git a/grammar.txt b/grammar.txt
new file mode 100644
index 0000000..84b8123
--- /dev/null
+++ b/grammar.txt
@@ -0,0 +1,29 @@
+let x = 2;
+ y = 3; in
+ (x y)
+
+let x: (Int) = 2;
+ y: (Int) = 3;
+ f: ((Int -> Int) -> Int) = [a, b] { ((plus a) b) }; in
+ ((f x) y)
+---
+
+
+LetStatement: "let" [Assignment ";"]+ "in" Body
+Binding: Ident (":" TypeDecl)?
+Assignment: Binding "=" Computation
+Computation: Identifier | Application | Abstraction
+Application: "(" Computation Computation ")"
+Abstraction: "[" UncurriedArguments "]" "{" Computation "}"
+UncurriedArguments: Binding ("," Binding)+
+
+LetStatement: "let" Ident (":" TypeDecl)? "=" Computation in
+
+BaseType: Identifier
+Arrow: TypeDecl "->" TypeDecl
+TypeDecl: "(" BaseType | Arrow ")"
+
+Binding: Identifier (":" TypeDecl)?
+UncurriedArguments: Identifier
+Abstraction: UncurriedArguments "{" Binding "=>" Computation "}"
+