summaryrefslogtreecommitdiff
path: root/grammar.txt
blob: f3de822b13783ad4b3991001100771409016b81c (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
30
31
32
33
34
35
36
37
38
39
40
41
let x = 2;
    y = 3; in
  (x y)

// If all functions are curried, can I do something like this?
let f: (((Int) -> (Int)) -> Int) = [a, b, c = (((if 1) a) b)] { (plus ((plus a) b) c) }; in

let x: (Int);
    y: (Int) = { x };
    z = x; in
        x = 2
        y()
     
        

      let y: (Int) = { x }; in
        y;
    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 "=" Statement
Statement: LetStatement | Abstraction
Computation: Identifier | Application | Abstraction
Application: "(" Computation Computation ")"
Abstraction: "[" UncurriedArguments "]" "{" Computation "}"

LetStatement: "let" Ident (":" TypeDecl)? "=" Computation in

BaseType: Identifier
Arrow: TypeDecl "->" TypeDecl
TypeDecl: "(" BaseType | Arrow ")"

Binding: Identifier (":" TypeDecl)?
UncurriedArguments: Identifier ["," Identifier]+
Abstraction: UncurriedArguments "{" Binding "=>" Computation "}"