Compare commits
2 commits
c3fbf3368f
...
bed94f3d41
| Author | SHA1 | Date | |
|---|---|---|---|
| bed94f3d41 | |||
| 973acd4151 |
12 changed files with 1601 additions and 1284 deletions
|
|
@ -33,6 +33,7 @@ module.exports = grammar({
|
|||
|
||||
star : $ => "*",
|
||||
square : $ => choice('□', '[]'),
|
||||
sort : $ => choice($.star, $.square, seq($.square, /[0-9₀₁₂₃₄₅₆₇₈₉]+/)),
|
||||
|
||||
labs : $ => seq(
|
||||
choice('λ', 'fun'),
|
||||
|
|
@ -52,8 +53,7 @@ module.exports = grammar({
|
|||
|
||||
term : $ => choice(
|
||||
$.identifier,
|
||||
$.star,
|
||||
$.square,
|
||||
$.sort,
|
||||
seq('(', $.expr, ')'),
|
||||
),
|
||||
|
||||
|
|
|
|||
32
src/grammar.json
generated
32
src/grammar.json
generated
|
|
@ -94,6 +94,32 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"sort": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "star"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "square"
|
||||
},
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "square"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[0-9₀₁₂₃₄₅₆₇₈₉]+"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"labs": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
|
|
@ -202,11 +228,7 @@
|
|||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "star"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "square"
|
||||
"name": "sort"
|
||||
},
|
||||
{
|
||||
"type": "SEQ",
|
||||
|
|
|
|||
25
src/node-types.json
generated
25
src/node-types.json
generated
|
|
@ -319,6 +319,25 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "sort",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "square",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "star",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "square",
|
||||
"named": true,
|
||||
|
|
@ -341,11 +360,7 @@
|
|||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "square",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "star",
|
||||
"type": "sort",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
|
|
|
|||
2728
src/parser.c
generated
2728
src/parser.c
generated
File diff suppressed because it is too large
Load diff
|
|
@ -17,7 +17,8 @@ def foo (A B : *) (f : A -> B) (x : A) :=
|
|||
(app_term
|
||||
(app
|
||||
(term
|
||||
(star))))))
|
||||
(sort
|
||||
(star)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ def foo (A B : *) (f : A -> A -> B) (x : A) := f x x;
|
|||
(app_term
|
||||
(app
|
||||
(term
|
||||
(star))))))
|
||||
(sort
|
||||
(star)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ axiom nat : *;
|
|||
(app_term
|
||||
(app
|
||||
(term
|
||||
(star))))))))
|
||||
(sort
|
||||
(star)))))))))
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ def baz : * := A;
|
|||
(app_term
|
||||
(app
|
||||
(term
|
||||
(star))))))
|
||||
(sort
|
||||
(star)))))))
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ def foo := fun (A : *) (x : A) : A => x;
|
|||
(app_term
|
||||
(app
|
||||
(term
|
||||
(star))))))
|
||||
(sort
|
||||
(star)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ def rel := forall (A : *) (x : A), *;
|
|||
(app_term
|
||||
(app
|
||||
(term
|
||||
(star))))))
|
||||
(sort
|
||||
(star)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
|
|
@ -30,4 +31,5 @@ def rel := forall (A : *) (x : A), *;
|
|||
(app_term
|
||||
(app
|
||||
(term
|
||||
(star))))))))))
|
||||
(sort
|
||||
(star)))))))))))
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ def foo (A : *) (x y z : A) := x;
|
|||
(app_term
|
||||
(app
|
||||
(term
|
||||
(star))))))
|
||||
(sort
|
||||
(star)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(identifier)
|
||||
|
|
|
|||
72
test/corpus/sorts.txt
Normal file
72
test/corpus/sorts.txt
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
=====
|
||||
Sorts
|
||||
=====
|
||||
|
||||
def foo (A : *) (B : □) (C : □₁) (D : []) (E : []1) (F : □1) (G : □₁₂₃) := A;
|
||||
|
||||
---
|
||||
|
||||
(program
|
||||
(definition
|
||||
(identifier)
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(star)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(identifier)))))))
|
||||
Loading…
Reference in a new issue