Created
May 18, 2014 17:33
-
-
Save tak1n/6ff522b0bb051e922bde to your computer and use it in GitHub Desktop.
blubb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tokenized input: | |
[[:T_KEYWORD_DEF, "->"], [:T_LITERAL, "ohai"], [:T_LBR, "("], [:T_LITERAL, "a"], [:T_COL, ","], [:T_LITERAL, "b"], [:T_COL, ","], [:T_LITERAL, "d"], [:T_COL, ","], [:T_LITERAL, "e"], [:T_RBR, ")"], [:T_LITERAL, "c"], [:T_EQ, "="], [:T_LITERAL, "a"], [:T_MUL, "*"], [:T_LITERAL, "b"], [:T_LITERAL, "f"], [:T_EQ, "="], [:T_LITERAL, "c"], [:T_ADD, "+"], [:T_LITERAL, "d"], [:T_MUL, "*"], [:T_LITERAL, "e"], [:T_KEYWORD_OUT, "puts"], [:T_LITERAL, "c"], [:T_KEYWORD_END, "<-"], [:T_LITERAL, "ohai"], [:T_LBR, "("], [:T_INT, 3], [:T_COL, ","], [:T_INT, 5], [:T_COL, ","], [:T_INT, 8], [:T_COL, ","], [:T_INT, 9], [:T_RBR, ")"]] | |
Abstract Syntax Tree: | |
[:block, [:stmt, [:defn, "ohai", [:arglist, [:literal, :a], [:literal, :b], [:literal, :d], [:literal, :e]], [:block, [:stmt, [:equal, [:literal, :c], [:op, [:mul, [:literal, :a], [:literal, :b]]]], [:equal, [:literal, :f], [:op, [:mul, [:op, [:add, [:literal, :c], [:literal, :d]]], [:literal, :e]]]], [:stdout, [:literal, :c]]]]], [:call, "ohai", [:arglist, [:int, 3], [:int, 5], [:int, 8], [:int, 9]]]]] | |
Generated Code: | |
"def ohai(a,b,d,e)\n c = a*b\nf = c+d*e\nputs c\nend\n\nohai(3,5,8,9)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment