Slide 16
Slide 16 text
JavaScript AST࣮ࡍͲΜͳίʔυʹͳΔͷ͔
ࠓճacornΛͬͯASTʹม͢ΔͱԼهͷΑ͏ͳJSONܗ͕ࣜ
Ͱ͖·͢ɻ
{
"type": "Program",
"start": 0,
"end": 69,
"body": [
{
"type": "VariableDeclaration",
"start": 0,
"end": 26,
"declarations": [
{
"type": "VariableDeclarator",
"start": 4,
"end": 25,
"id": {
"type": "Identifier",
"start": 4,
"end": 9,
"name": "hello"
},
"init": {
"type": "Literal",
"start": 12,
"end": 25,
"value": "Hello World",
"raw": "'Hello World'"
}
}
],
"kind": "var"
},
{
"type": "FunctionDeclaration",
"start": 27,
"end": 69,
"id": {
"type": "Identifier",
"start": 36,
"end": 44,
"name": "sayHello"
},
"generator": false,
"expression": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 47,
"end": 69,
"body": [
{
"type": "ExpressionStatement",
"start": 49,
"end": 67,
"expression": {
"type": "CallExpression",
"start": 49,
"end": 67,
"callee": {
"type": "MemberExpression",
"start": 49,
"end": 60,
"object": {
"type": "Identifier",
"start": 49,
"end": 56,
"name": "console"
},
"property": {
"type": "Identifier",
"start": 57,
"end": 60,
"name": "log"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 61,
"end": 66,
"name": "hello"
}
]
}
}
]
}
}
],
"sourceType": "module"
}