Convert syntax tree to Evaluator
This commit is contained in:
parent
bbe1b96341
commit
fdd841a2d2
@ -3,9 +3,12 @@ module.exports = grammar({
|
||||
|
||||
rules: {
|
||||
source: $ => repeat(choice(
|
||||
$.comment,
|
||||
$.statement,
|
||||
)),
|
||||
|
||||
comment: $ => seq('#', /.*/),
|
||||
|
||||
statement: $ => seq($.expression, $.close),
|
||||
|
||||
expression: $ => choice(
|
||||
|
@ -6,6 +6,10 @@
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "comment"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
@ -13,6 +17,19 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"comment": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "#"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": ".*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"statement": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
|
@ -4,6 +4,11 @@
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true,
|
||||
@ -74,6 +79,10 @@
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "comment",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "statement",
|
||||
"named": true
|
||||
@ -139,6 +148,10 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "#",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "(",
|
||||
"named": false
|
||||
|
825
src/parser.c
825
src/parser.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user