diff options
Diffstat (limited to 'gock.ts')
| -rw-r--r-- | gock.ts | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/gock.ts b/gock.ts deleted file mode 100644 index e8d1c53..0000000 --- a/gock.ts +++ /dev/null @@ -1,42 +0,0 @@ -type Int = "Int"; -type Bool = "Bool"; -type Atom = Int | Bool; -type SimpleType = Arrow | Atom; -type Arrow = { - left: SimpleType; - right: SimpleType; -}; - -type Identifier = string; - -type Binding = { - name: Identifier; - type?: SimpleType; -}; - -type Abstraction = { - binding: Binding; - body: ASTNode; -}; - -type ASTNode = Abstraction | Application | Identifier; - -// - -class Environment<T> { - constructor(private readonly _captures: Map<Identifier, T>, private readonly _parent?: Environment) {} - - public add(identifier: Identifier, substitution: T): Environment<T> { - const captures = new HashMap(); captures.put(identifier, substitution); - return new Environment<>(captures, this); - } - - public get(identifier: Identifier): T? { - if (this._captures.has(identifier)) return this._captures.get(identifier); - return this._parent?.get(identifier); - } -} - -//const tokenize -// const parse -// const check |
