diff options
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 "}" |
