parser for types + start moving all types to separate modules

This commit is contained in:
Joeri Exelmans 2025-05-06 23:41:12 +02:00
parent 8eec5b9239
commit 1d826ea8d4
11 changed files with 277 additions and 88 deletions

15
examples/parser.js Normal file
View file

@ -0,0 +1,15 @@
import { parse } from "../parser/parser.js";
import { prettyGenT, prettyT } from "../util/pretty.js";
console.log(prettyT(parse("Int"))); // Int
console.log(prettyT(parse("Int * Bool"))); // (Int Bool)
console.log(prettyT(parse("(((((((Int)))) => ((Bool)))))"))); // (Int => Bool)
console.log(prettyT(parse("#0((Int * #0) + Unit)"))) // #0((Int #0) + Unit)
console.log(prettyGenT(parse("∀a: #0((a * #0) + Unit"))); // ∀a: #0((a #0) + Unit)
console.log(prettyGenT(parse("∀a,b,c,d: (a*b) + (c*d)"))); // ∀a,b,c,d: ((a b) + (c d))