Inspiration
We all remember learning BIDMAS (BODMAS or PEMDAS to some), but more importantly we all remember struggling with it. To this day, there is confusion as to how exactly it works. We hope to simplify this for everyone using our knowledge of compilers and Abstract Syntax Trees, hence bidmAST.
What it does
bidmAST takes in a string describing a mathematical equation, and returns an abstract syntax tree detailing the exact steps needed perform the final computation, simply shown as the operation and the two required suboperations underneath it. It allows users to step through each layer one by one, to see exactly what each level of computation requires.
How we built it
The compiler was build using Flex for lexing, YACC for parsing and C++ for code generation. We use NodeJS and React-native to build a the web/phone portable app, and some shell scripting to manage communication between the front and backend.
Challenges we ran into
Generating the AST and making sure it was accurate needed a lot of thinking from us, which slowed down the development a lot. Generating an arbitrarily sized tree was also difficult, as well as creating a fast, reliable, error-free way for the frontend to communicate with the backend.
Accomplishments that we're proud of
It works!
What we learned
We should use modern tools to build a compiler, even one as relatively simple as this one. We also need to make it more scalable.
What's next for bidmAST
Adding functionality for control loops and bitwise or logical operations to ease people into thinking about programming. Also a nicer frontend.
Built With
- c++
- flex
- node.js
- react-native
- shell
- yacc
Log in or sign up for Devpost to join the conversation.