Git Product home page Git Product logo

expression_calculator_in_cpp's Introduction

Expression Calculator

A calculator for expressions with predefined grammar, including basic calcualtions, let statements, if statements, and function calls. The expressions can be typed in or imported from existing files.

Grammar

  1. Add: <expression1> + <expression2>
  2. Multiply: <expression1> * <expression1>
  3. Variable (only accept alphabetic words): , x, var, ...
  4. Let: _let x = 3 _in x + 1, ...
  5. Bool: _true & _false, ...
  6. Comparison: <expression1> == <expression2>
  7. If: _if _true _then 0 _else 1, _if x == 5 _then x + 1 _else x,
  8. Function: _fun(x) x + 1, ...
  9. Function call: (_fun(x) x + 1)(1), _let f = _fun(x) x + 1 _in f(1), ...

Run it locally

  1. clone the repo: git clone https://github.com/Sonia-96/Expression_Calculator_in_CPP
  2. open Calculator/Calculator.pro file

Use it

Interp

Calculate the result of an expression. For example, the result of Fibonacci(10) is 55.

image-20230504175113638

Pretty Print

Print an expression in a nicer format. In the following example, the statements will be aligned and the redundant brackets will be removed through Pretty Print mode.

image-20230504180255238

expression_calculator_in_cpp's People

Contributors

sonia-96 avatar ahoppel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.