Web API to parse an expression into an Abstract Syntax Tree.
Easy, lightweight parsing solution to turn any expression and operators into an AST.
No external parsing tool needed.
- Maven
- Java 8+
Request
{
"expression": "(x+y)*z",
"operators": [
{
"symbol": "+",
"precedence": 1,
"type": "binary"
},
{
"symbol": "-",
"precedence": 1,
"type": "binary"
},
{
"symbol": "*",
"precedence": 2,
"type": "binary"
},
{
"symbol": "/",
"precedence": 2,
"type": "binary"
}
]
}
Response
{
"status": "success",
"root": {
"value": "*",
"left": {
"value": "+",
"left": {
"value": "x",
"left": null,
"right": null
},
"right": {
"value": "y",
"left": null,
"right": null
}
},
"right": {
"value": "z",
"left": null,
"right": null
}
}
}