slightly simplified grammar
This commit is contained in:
parent
63f0f27240
commit
b646790fdb
5 changed files with 1788 additions and 1976 deletions
12
grammar.js
12
grammar.js
|
|
@ -46,23 +46,15 @@ module.exports = grammar({
|
||||||
';'
|
';'
|
||||||
),
|
),
|
||||||
|
|
||||||
variable_binding : $ => seq(
|
|
||||||
'(',
|
|
||||||
repeat1(choice($.identifier, $.symbol)),
|
|
||||||
':',
|
|
||||||
field('type', $.expr),
|
|
||||||
')',
|
|
||||||
),
|
|
||||||
|
|
||||||
variable : $ => seq(
|
variable : $ => seq(
|
||||||
choice('variable', 'hypothesis'),
|
choice('variable', 'hypothesis'),
|
||||||
repeat1($.variable_binding),
|
repeat1($.param_block),
|
||||||
';'
|
';'
|
||||||
),
|
),
|
||||||
|
|
||||||
param_block : $ => seq(
|
param_block : $ => seq(
|
||||||
'(',
|
'(',
|
||||||
field('param', repeat1($.identifier)),
|
field('param', repeat1(choice($.identifier, $.symbol))),
|
||||||
':',
|
':',
|
||||||
field('type', $.expr),
|
field('type', $.expr),
|
||||||
')'
|
')'
|
||||||
|
|
|
||||||
52
src/grammar.json
generated
52
src/grammar.json
generated
|
|
@ -116,47 +116,6 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"variable_binding": {
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "("
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "REPEAT1",
|
|
||||||
"content": {
|
|
||||||
"type": "CHOICE",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "symbol"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": ":"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "FIELD",
|
|
||||||
"name": "type",
|
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "expr"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": ")"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"variable": {
|
"variable": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
|
|
@ -177,7 +136,7 @@
|
||||||
"type": "REPEAT1",
|
"type": "REPEAT1",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "variable_binding"
|
"name": "param_block"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -199,8 +158,17 @@
|
||||||
"content": {
|
"content": {
|
||||||
"type": "REPEAT1",
|
"type": "REPEAT1",
|
||||||
"content": {
|
"content": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "identifier"
|
"name": "identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "symbol"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
36
src/node-types.json
generated
36
src/node-types.json
generated
|
|
@ -359,6 +359,10 @@
|
||||||
{
|
{
|
||||||
"type": "identifier",
|
"type": "identifier",
|
||||||
"named": true
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "symbol",
|
||||||
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -507,37 +511,7 @@
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "variable_binding",
|
"type": "param_block",
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "variable_binding",
|
|
||||||
"named": true,
|
|
||||||
"fields": {
|
|
||||||
"type": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "expr",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"children": {
|
|
||||||
"multiple": true,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "identifier",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "symbol",
|
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
3652
src/parser.c
generated
3652
src/parser.c
generated
File diff suppressed because it is too large
Load diff
|
|
@ -18,7 +18,7 @@ end Test
|
||||||
(identifier)
|
(identifier)
|
||||||
(program
|
(program
|
||||||
(variable
|
(variable
|
||||||
(variable_binding
|
(param_block
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)
|
(identifier)
|
||||||
|
|
@ -30,7 +30,7 @@ end Test
|
||||||
(sort
|
(sort
|
||||||
(star)))))))))
|
(star)))))))))
|
||||||
(variable
|
(variable
|
||||||
(variable_binding
|
(param_block
|
||||||
(identifier)
|
(identifier)
|
||||||
(expr
|
(expr
|
||||||
(app_term
|
(app_term
|
||||||
|
|
@ -38,7 +38,7 @@ end Test
|
||||||
(app
|
(app
|
||||||
(term
|
(term
|
||||||
(identifier)))))))
|
(identifier)))))))
|
||||||
(variable_binding
|
(param_block
|
||||||
(identifier)
|
(identifier)
|
||||||
(expr
|
(expr
|
||||||
(app_term
|
(app_term
|
||||||
|
|
@ -46,7 +46,7 @@ end Test
|
||||||
(app
|
(app
|
||||||
(term
|
(term
|
||||||
(identifier)))))))
|
(identifier)))))))
|
||||||
(variable_binding
|
(param_block
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)
|
(identifier)
|
||||||
(expr
|
(expr
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue