Arithmetic evaluation: Difference between revisions
Content added Content deleted
(Added Julia) |
m (Fixed Julia) |
||
Line 2,249: | Line 2,249: | ||
Julia's homoiconic nature and strong metaprogramming facilities make AST/Expression parsing and creation as accessible and programmatic as other language features |
Julia's homoiconic nature and strong metaprogramming facilities make AST/Expression parsing and creation as accessible and programmatic as other language features |
||
<lang julia>julia> expr="2 * (3 -1) + 2 * 5" |
<lang julia>julia> expr="2 * (3 -1) + 2 * 5" |
||
"2 * (3 -1) + 2 * 5" |
|||
julia> parsed = parse(expr) |
|||
:(+(*(2,-(3,1)),*(2,5))) |
|||
julia> t = typeof(parsed) |
|||
Expr |
|||
julia> names(t) #shows type fields |
|||
(:head,:args,:typ) |
|||
julia> expr="2 * (3 -1) + 2 * 5" |
|||
"2 * (3 -1) + 2 * 5" |
"2 * (3 -1) + 2 * 5" |
||