accommodated new ascriptions
This commit is contained in:
parent
6de6e3d801
commit
c3fbf3368f
5 changed files with 1239 additions and 907 deletions
|
|
@ -37,6 +37,7 @@ module.exports = grammar({
|
||||||
labs : $ => seq(
|
labs : $ => seq(
|
||||||
choice('λ', 'fun'),
|
choice('λ', 'fun'),
|
||||||
repeat1($.param_block),
|
repeat1($.param_block),
|
||||||
|
optional($.ascription),
|
||||||
choice('=>', '⇒'),
|
choice('=>', '⇒'),
|
||||||
$.expr,
|
$.expr,
|
||||||
),
|
),
|
||||||
|
|
@ -44,6 +45,7 @@ module.exports = grammar({
|
||||||
pabs : $ => seq(
|
pabs : $ => seq(
|
||||||
choice('∏', 'forall'),
|
choice('∏', 'forall'),
|
||||||
repeat1($.param_block),
|
repeat1($.param_block),
|
||||||
|
optional($.ascription),
|
||||||
',',
|
',',
|
||||||
$.expr,
|
$.expr,
|
||||||
),
|
),
|
||||||
|
|
@ -75,8 +77,6 @@ module.exports = grammar({
|
||||||
|
|
||||||
app : $ => repeat1($.term),
|
app : $ => repeat1($.term),
|
||||||
|
|
||||||
axiom : $ => 'axiom',
|
|
||||||
|
|
||||||
arrow : $ => prec.left(1, seq(
|
arrow : $ => prec.left(1, seq(
|
||||||
$.app_term,
|
$.app_term,
|
||||||
choice('->', '→'),
|
choice('->', '→'),
|
||||||
|
|
|
||||||
88
src/grammar.json
generated
88
src/grammar.json
generated
|
|
@ -117,6 +117,18 @@
|
||||||
"name": "param_block"
|
"name": "param_block"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "ascription"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
|
@ -159,6 +171,18 @@
|
||||||
"name": "param_block"
|
"name": "param_block"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "ascription"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": ","
|
"value": ","
|
||||||
|
|
@ -282,38 +306,6 @@
|
||||||
"name": "term"
|
"name": "term"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"axiom": {
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "axiom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "FIELD",
|
|
||||||
"name": "name",
|
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "REPEAT",
|
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "param_block"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "ascription"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": ";"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"arrow": {
|
"arrow": {
|
||||||
"type": "PREC_LEFT",
|
"type": "PREC_LEFT",
|
||||||
"value": 1,
|
"value": 1,
|
||||||
|
|
@ -395,6 +387,38 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"axiom": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "axiom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "name",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "param_block"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "ascription"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ";"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"definition": {
|
"definition": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
|
|
|
||||||
8
src/node-types.json
generated
8
src/node-types.json
generated
|
|
@ -194,6 +194,10 @@
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "ascription",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "expr",
|
"type": "expr",
|
||||||
"named": true
|
"named": true
|
||||||
|
|
@ -232,6 +236,10 @@
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "ascription",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "expr",
|
"type": "expr",
|
||||||
"named": true
|
"named": true
|
||||||
|
|
|
||||||
2038
src/parser.c
generated
2038
src/parser.c
generated
File diff suppressed because it is too large
Load diff
|
|
@ -2,7 +2,7 @@
|
||||||
Lambda Abstraction
|
Lambda Abstraction
|
||||||
==================
|
==================
|
||||||
|
|
||||||
def foo := fun (A : *) (x : A) => x;
|
def foo := fun (A : *) (x : A) : A => x;
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|
@ -26,6 +26,12 @@ def foo := fun (A : *) (x : A) => x;
|
||||||
(app
|
(app
|
||||||
(term
|
(term
|
||||||
(identifier))))))
|
(identifier))))))
|
||||||
|
(ascription
|
||||||
|
(expr
|
||||||
|
(app_term
|
||||||
|
(app
|
||||||
|
(term
|
||||||
|
(identifier))))))
|
||||||
(expr
|
(expr
|
||||||
(app_term
|
(app_term
|
||||||
(app
|
(app
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue