Mathmatical parser and executer, with a AST visualizer
  • Go 71.1%
  • Java 21.5%
  • JavaScript 3.7%
  • CSS 1.6%
  • ANTLR 1.3%
  • Other 0.8%
Find a file
2026-09-29 23:30:33 +01:00
grammar parser, tree visualizer and evaluator 2026-09-29 23:30:33 +01:00
src parser, tree visualizer and evaluator 2026-09-29 23:30:33 +01:00
.gitignore Initial commit 2026-09-29 22:01:47 +00:00
compose.yaml parser, tree visualizer and evaluator 2026-09-29 23:30:33 +01:00
Dockerfile parser, tree visualizer and evaluator 2026-09-29 23:30:33 +01:00
go.mod parser, tree visualizer and evaluator 2026-09-29 23:30:33 +01:00
go.sum parser, tree visualizer and evaluator 2026-09-29 23:30:33 +01:00
LICENSE Initial commit 2026-09-29 22:01:47 +00:00
README.md parser, tree visualizer and evaluator 2026-09-29 23:30:33 +01:00

rb-mymath

Mathmatical parser and executer, with a AST visualizer

Notes

MyMath_AST

each function is a tree
there is a variable table

main execution is also a tree but the main default one

Statements:  BlockNode(n)  AssignNode(name, 1)  ReturnNode(1)

Expressions: BinaryNode(op, 2)  UnaryNode(op, 1)  IfNode(3)
             CallNode(name, n)  LambdaNode(params, body=BlockNode)

Leaves:      NumNode(float64)  VarNode(name)

Runtime values: Number | Function{params, body, scope}
Scope: {vars map, parent *Scope}



Leaves:      
    NumNode(float64) 
    # integerLiteral
    # decimalLiteral
    # scientificLiteral

    VarNode(name)
    # variable

Expressions: 
    BinaryNode(op, 2)  
    # mulDivModExpr
    # implicitMulExpr
    # addSubExpr
    # comparisonExpr
    # equalityExpr
    # andExpr
    # xorExpr
    # orExpr
    # powerExpr

    UnaryNode(op, 1)  
    # unaryExpr
    # notExpr
    # signedExponent
    # parenExpr

    IfNode(3)         
    # ifExpr


    
    # assignment

    CallNode(name, n)  
    # functionCall

    LambdaNode(params, body=BlockNode)
    # block
    # returnStatement
    # blockLambda
    # arrowLambda

    

java -jar ~/dev/antl4/antlr-4.13.2.jar   -Dlanguage=Go -visitor -listener   -package parser   -Xexact-output-dir -o ./src/parser   ./grammar/MathLexer.g4 ./grammar/MathParser.g4