parser for types + start moving all types to separate modules
This commit is contained in:
parent
8eec5b9239
commit
1d826ea8d4
11 changed files with 277 additions and 88 deletions
15
examples/parser.js
Normal file
15
examples/parser.js
Normal 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))
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue