Ai4EMetaPSE.jl can parse:
- julia ASTs(abstract syntax tree) to a json file
- json file to julia AST
- a json file that include differential equations and generate julia solution code based on Sciml Ecosystem.
using Pkg
Pkg.add("Ai4EMetaPSE")
see more infomation in docs
using Ai4EMetaPSE
open(`s.json`, "w") do io
# parse a function f(x) to json file
s = @julia2json function f(x)
x + 1
end
JSON3.pretty(io, s)
end
In s.json
:
{
"args": [
{
"args": [
"f",
"x"
],
"head": "call"
},
{
"args": [
{
"LINENUMBERNODE": {
"line": 11,
"file": "e:\\develop\\Ai4EMetaPSE.jl\\test\\julia2json.jl"
}
},
{
"LINENUMBERNODE": {
"line": 12,
"file": "e:\\develop\\Ai4EMetaPSE.jl\\test\\julia2json.jl"
}
},
{
"args": [
"+",
"x",
1
],
"head": "call"
}
],
"head": "block"
}
],
"head": "function"
}