Math Parsing
Explore arithmetic parsing, syntax trees, and expression evaluation.
Created ~5 min explore
Math parsing
Contoh Cepat
Token Stream
1 + 2 * 3
Hasil Evaluasi
7
Waktu Parse
0.000 ms
Waktu Kalkulasi
0.000 ms
Hasil Simplifikasi
Ekspresi Sederhana
7
Langkah Penyelesaian
Langkah 1
2 * 3 = 6
1 + 2 * 3
1 + 6
Langkah 2
1 + 6 = 7
1 + 6
7
Abstract Syntax Tree
JSON
{
"left": {
"type": "NumberLiteral",
"value": 1
},
"operator": "+",
"right": {
"left": {
"type": "NumberLiteral",
"value": 2
},
"operator": "*",
"right": {
"type": "NumberLiteral",
"value": 3
},
"type": "BinaryExpression"
},
"type": "BinaryExpression"
}Tree Diagram (Mermaid)
Legend
RootNode akar AST
+Binary operator
-Unary operator
sin()Function call
xIdentifier
piConstant
42Number
Export
Batasan, Asumsi, dan Kemampuan
Batasan dan Asumsi Tool
- Mendukung operator +, -, *, /, %, ^, fungsi sin/cos/tan/log/sqrt, konstanta pi/e, dan implicit multiplication.
- Trigonometri memakai satuan radian. log(x) memakai natural log.
- Evaluasi real-number only: log(x) valid untuk x > 0, sqrt(x) valid untuk x >= 0.
- Waktu parse dan kalkulasi adalah estimasi rata-rata 1000 kali run.
- Penyederhanaan simbolik memakai aturan deterministik inti, bukan mesin CAS penuh.
Kemampuan yang Bisa Dicapai
- Operator lanjutan: pangkat (^), modulo (%), dan akar (sqrt).
- Variabel dinamis dengan substitusi nilai langsung di UI.
- Fungsi matematika: sin, cos, tan, log, dan sqrt.
- Penyederhanaan simbolik dasar (contoh: 2x + 3x - x menjadi 4x).
- Langkah kalkulasi operation-by-operation dari AST sampai hasil akhir.
- Export AST/diagram ke JSON, Mermaid source, dan PNG.