Skip to content

Instantly share code, notes, and snippets.

@leto
Created March 27, 2011 17:48
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 leto/889410 to your computer and use it in GitHub Desktop.
Save leto/889410 to your computer and use it in GitHub Desktop.
Jaspers AST
(sarkomand)(~/git/jaspers master* )$ node jaspers.js
{ type: 'Program',
elements:
[ { type: 'VariableStatement', declarations: [Object] },
{ type: 'FunctionCall', name: [Object], arguments: [] },
{ type: 'VariableStatement', declarations: [Object] },
{ type: 'VariableStatement', declarations: [Object] },
{ type: 'Function',
name: 'bar',
params: [Object],
elements: [Object] },
{ type: 'FunctionCall',
name: [Object],
arguments: [Object] } ] }
{ type: 'VariableDeclaration',
name: 'f',
value:
{ type: 'Function',
name: null,
params: [],
elements: [ [Object] ] } }
[ { type: 'ReturnStatement',
value: { type: 'NumericLiteral', value: 42 } } ]
(sarkomand)(~/git/jaspers master )$ cat test.js
var f = function() {
return 42;
};
f();
var num1 = 3.14;
var num2 = "Inf";
function bar(x) { return 55; }
bar(52);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment