Convert syntax tree to Evaluator

This commit is contained in:
Jeff 2023-09-28 22:55:47 -04:00
parent bbe1b96341
commit fdd841a2d2
4 changed files with 490 additions and 368 deletions

View File

@ -3,9 +3,12 @@ module.exports = grammar({
rules: {
source: $ => repeat(choice(
$.comment,
$.statement,
)),
comment: $ => seq('#', /.*/),
statement: $ => seq($.expression, $.close),
expression: $ => choice(

View File

@ -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": [

View File

@ -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

File diff suppressed because it is too large Load Diff