Skip to content

Instantly share code, notes, and snippets.

@conartist6
Last active October 5, 2023 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conartist6/e58922d3f4a8835f98ccfe5c4e915175 to your computer and use it in GitHub Desktop.
Save conartist6/e58922d3f4a8835f98ccfe5c4e915175 to your computer and use it in GitHub Desktop.
@bablr/boot sample instruction AST
// eat(<| Token 'foo' |>
{
"tagName": {
"language": "Instruction",
"type": "Call"
},
"children": [
{
"type": "Reference",
"value": "verb"
},
{
"type": "Reference",
"value": "open"
},
{
"type": "Reference",
"value": "argument"
},
{
"type": "Reference",
"value": "close"
}
],
"properties": {
"verb": {
"tagName": {
"language": "Instruction",
"type": "Identifier"
},
"children": [
"eat"
],
"attrs": {}
},
"open": {
"tagName": {
"language": "Instruction",
"type": "Punctuator"
},
"children": [
"("
],
"attrs": {}
},
"argument": {
"tagName": {
"language": "Spamex",
"type": "TokenMatcher"
},
"children": [
{
"type": "Reference",
"value": "open"
},
{
"type": "Trivia",
"value": " "
},
{
"type": "Reference",
"value": "tagName"
},
{
"type": "Trivia",
"value": " "
},
{
"type": "Reference",
"value": "value"
},
{
"type": "Trivia",
"value": " "
},
{
"type": "Reference",
"value": "close"
}
],
"properties": {
"open": {
"tagName": {
"language": "Spamex",
"type": "Punctuator"
},
"children": [
"<|"
],
"attrs": {}
},
"tagName": {
"tagName": {
"language": "Spamex",
"type": "Identifier"
},
"children": [
"Token"
],
"attrs": {}
},
"value": {
"tagName": {
"language": "Spamex",
"type": "StringMatcher"
},
"children": [
{
"type": "Reference",
"value": "open"
},
{
"type": "Reference",
"value": "value"
},
{
"type": "Reference",
"value": "close"
}
],
"properties": {
"open": {
"tagName": {
"language": "Spamex",
"type": "Punctuator"
},
"children": [
"'"
],
"attrs": {}
},
"value": {
"tagName": {
"language": "Spamex",
"type": "Literal"
},
"children": [
"foo"
],
"attrs": {}
},
"close": {
"tagName": {
"language": "Spamex",
"type": "Punctuator"
},
"children": [
"'"
],
"attrs": {}
}
},
"attrs": {}
},
"close": {
"tagName": {
"language": "Spamex",
"type": "Punctuator"
},
"children": [
"|>"
],
"attrs": {}
}
},
"attrs": {}
},
"close": {
"tagName": {
"language": "Instruction",
"type": "Punctuator"
},
"children": [
")"
],
"attrs": {}
}
},
"attrs": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment