summaryrefslogtreecommitdiff
path: root/grammar.txt
blob: 84b8123540257133cd3df8a6ae1b225de1a749d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 "}"