Ai4EMetaPSE.jl

A json parser , from ODE json files to julia solution code
Author ai4energy
Popularity
7 Stars
Updated Last
1 Year Ago
Started In
September 2022

Ai4EMetaPSE

Stable Dev Build Status

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.

Install

using Pkg
Pkg.add("Ai4EMetaPSE")

Document

see more infomation in docs

Example

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"
}

Used By Packages

No packages found.