Code Monkey home page Code Monkey logo

python-to-c-compliler's Introduction

Python-to-C-compliler

Python

Compiling python to c language using python language, lex and yacc

Table of Contents

Intruduction

Lex in compiler design is a program used to generate scanners or lexical analyzers, also called tokenizers. These tokenizers identify the lexical pattern in the input program and convert the input text into the sequence of tokens. It is used with the YACC parser generator.

YACC (yet another compiler compiler) is a grammar parser and parser generator. That is, it is a program that reads a grammar specification and generates code that is able to organize input tokens in a syntactic tree in accordance with the grammar.

In this project we are using these concepts and convert python file to c file.

Features

  • Implementation all in python langauge so you don't need other softwares
  • Clean code

Project Structure

The project follows a specific structure to organize its files and directories:

├── README.md
├── TokList.txt
├── c.txt
├── lex.py
├── p.txt
├── parser.out
├── parsetab.py
├── yacc.py
  • README.md: Documentation file providing information about the project.
  • TokList.txt: Tokens are stored in this file after lexical analysis.
  • c.txt: Output file in c language will be stored here.
  • lex.py: Script for lexical analysis that read input file and tokenize it.
  • p.txt: Input python file.
  • parser.out and parsetab.py: Auto generated file after parsing.
  • yac.py: Script for yacc handling.

Requirements

To run the x86 assembler, you need to have the following installed on your system:

  • Python (version 3.0 or higher)
  • PLY package
  • Git command line tool (or Git GUI client) to clone the repository.

Usage Guide

  1. Open a terminal and clone this repository: git clone https://github.com/hoseinmrh/Python-to-C-compliler
  2. Write your python file in p.txt then run yac.py. Output will be stored in c.txt.

python-to-c-compliler's People

Contributors

hoseinmrh avatar

Stargazers

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