Skip to content

A simple 4-function calculator parser program to demonstrate the application of the Abstract Syntax Tree

Notifications You must be signed in to change notification settings

WataNekko/simple-calculator-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

Simple Calculator Parser

A simple 4-function calculator parser program to demonstrate the application of the Abstract Syntax Tree (AST).

Calculator program

The calculator program in src/ is to be compiled with C++17. E.g.,

cd src/
g++ -std=c++17 -Wall main.cpp calculator/*.cpp -o calc

Then run the REPL with ./calc, or optionally specify the file name to which to output the AST in JSON format with an additional argument (E.g., ./calc output.json).

AST Visualization

The outputted AST in the .json file can be visualized with the Python script visualize_ast.py (E.g., python visualize_ast.py output.json). See help with the command python visualize_ast.py -h.

About

A simple 4-function calculator parser program to demonstrate the application of the Abstract Syntax Tree

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published