diff options
| author | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-08-11 07:23:07 -0700 |
|---|---|---|
| committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-08-11 07:23:07 -0700 |
| commit | b5cb9f472d9b19d762aac91116b266f90404b9ca (patch) | |
| tree | 6685dbf39890a4db364df75f8510101e1449f120 /grammar.txt | |
| parent | fc2844ae88c85f082b47630b92a55bca3ff285b1 (diff) | |
| download | gock-b5cb9f472d9b19d762aac91116b266f90404b9ca.tar.gz gock-b5cb9f472d9b19d762aac91116b266f90404b9ca.zip | |
Parsin
Diffstat (limited to 'grammar.txt')
| -rw-r--r-- | grammar.txt | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/grammar.txt b/grammar.txt index 84b8123..ec9fa9c 100644 --- a/grammar.txt +++ b/grammar.txt @@ -2,20 +2,22 @@ let x = 2; y = 3; in (x y) -let x: (Int) = 2; +let x: (Int) = + let y: (Int) = { x }; in + y; y: (Int) = 3; - f: ((Int -> Int) -> Int) = [a, b] { ((plus a) b) }; in + f: (((Int) -> (Int)) -> Int) = [a, b] { ((plus a) b) }; in ((f x) y) --- LetStatement: "let" [Assignment ";"]+ "in" Body Binding: Ident (":" TypeDecl)? -Assignment: Binding "=" Computation +Assignment: Binding "=" Statement +Statement: LetStatement | Abstraction Computation: Identifier | Application | Abstraction Application: "(" Computation Computation ")" Abstraction: "[" UncurriedArguments "]" "{" Computation "}" -UncurriedArguments: Binding ("," Binding)+ LetStatement: "let" Ident (":" TypeDecl)? "=" Computation in @@ -24,6 +26,6 @@ Arrow: TypeDecl "->" TypeDecl TypeDecl: "(" BaseType | Arrow ")" Binding: Identifier (":" TypeDecl)? -UncurriedArguments: Identifier +UncurriedArguments: Identifier ["," Identifier]+ Abstraction: UncurriedArguments "{" Binding "=>" Computation "}" |
