Code Monkey home page Code Monkey logo

lex-yacc-practise's Introduction

Arithmetic Parser ๐Ÿงฎ

Description ๐Ÿ“

This project is an arithmetic parser developed using PLY (Python Lex-Yacc). It is capable of parsing and computing both simple and complex arithmetic expressions, providing a powerful tool for mathematical computations.

Features ๐ŸŒŸ

  • Support for Basic Operations: Addition (+), subtraction (-), multiplication (*), and division (/).
  • Advanced Operations: Exponentiation (^), modulus (mod), square root (sqrt()).
  • Variable Support: Ability to use variables for storing intermediate results.
  • Flexible Grammar: Uses context-free grammar for parsing expressions.
  • Interactive Mode: Input and compute expressions in real-time.

Installation ๐Ÿ”ง

To install and run the parser:

  1. Clone the repository.
  2. Install dependencies (pip install -r requirements.txt).
  3. Run main.py for interactive mode.

How to Use ๐Ÿš€

Simply run main.py and enter an arithmetic expression. Examples:

  • 2 + 3 * 4
  • x = 5
  • y = (x + 15)^4

Tests ๐Ÿงช

To run the tests, run unit_tests.py. This will run the test suite and output the results.

lex-yacc-practise's People

Contributors

yuriicodes 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.