diff options
| Commit | 26e1314c7ab843987ac0eb28deb96e708b2e943f (patch) | |
|---|---|---|
| Author | 2020-10-05 21:49:05 +0300 | |
| Committer | 2020-10-06 11:42:39 +0300 | |
| Files | 9d8ac2daf99ec64d6a4c66ac55ccb47a367c0d0c | |
| IPL-26e1314c7ab843987ac0eb28deb96e708b2e943f.tar IPL-26e1314c7ab843987ac0eb28deb96e708b2e943f.tar.gz IPL-26e1314c7ab843987ac0eb28deb96e708b2e943f.zip | ||
| Parent | 59fd41dc941aec6e90ed75de4b5c1eaf1b967fc4 (diff) | |
Add AST for simple JavaScript function
1 files changed, 20 insertions, 1 deletions
| -rw-r--r-- | website/content/slides/01_dragons/_index.md | 21 |
diff --git a/website/content/slides/01_dragons/_index.md b/website/content/slides/01_dragons/_index.md index 52ecf91..7892a65 100644 --- a/website/content/slides/01_dragons/_index.md +++ b/website/content/slides/01_dragons/_index.md @@ -197,7 +197,26 @@ LR(n) and LALR(n) are family of parsing algorithms for CFG --- ###### AST -# TODO: use JavaScript AST dumper +https://esprima.org/demo/parse.html?code=function%20answer()%20%7B%0A%20%20%20%20return%206%20*%207%3B%0A%7D + + { + "type": "FunctionDeclaration", + "id": { "type": "Identifier", "name": "answer" }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "*", + "left": { "type": "Literal", "value": 6 }, + "right": { "type": "Literal", "value": 7 } + } + } + ] + }, + } --- ### Middle |
