GithubHelp home page GithubHelp logo

yycorcino / python-flex-bison-compiler Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4 KB

Mini Python Compiler Capable of Printing: Strings and Arithmetic Operations

License: MIT License

Dockerfile 4.09% Makefile 4.73% Python 11.46% Lex 32.26% Yacc 47.47%
bison-flex flex-bison docker cscea321

python-flex-bison-compiler's Introduction


Python

Mini Python Compiler

A Simple Python Compiler that is capable of printing strings and printing basic arithmetic operations.

About The Project

A mini compiler demonstrating the use of data types utilizing Flex and Bison. In the case of Python, the print statement is able to take in multiple data types such as integers and string. The developer in Python would simply call print(<value>), however inside the compiler it requires complex design to determine the value type then it can print to the console.

Getting Started

Installing and configuring Flex and Bison using Docker.

Prerequisites

Have Docker pre-installed into your operating system.

  • Using CLI Command for Ubuntu
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    

Installation

Below is an example of how you download this project and start using Docker.

  1. Clone the repo
    git clone <repo_url>
    
  2. Go into the Project Repository
    cd /path/to/repository
    
  3. Build Image
    sudo docker build -t compiler-image .
    
  4. Run Container
    sudo docker run -it compiler-image
    
  5. Run Test inside Container
    $ make
    $ ./compiler <source_file>
    

Usage

Using the pre-defined Python file to test arithmetic operations and printing of strings.

$ make
$ ./compiler __test__/arithmetic.py

Remove all generated files.

make clean

License

Distributed under the MIT License. See LICENSE.txt for more information.

python-flex-bison-compiler's People

Contributors

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