Skip to content
This repo. contains the implementation of an interpreter for python 2.7.x using flex (scanner) and bison (parser) and written with C/C++.
Branch: master
Clone or download

README.md

python2-interpreter

This repository contains the implementation of an interpreter written for python 2.7.x using flex (scanner) and bison (parser). The interpreter was written in C/C++ and is capable of interpreting the following Python 2 language constructs:

  • Interger, float and string data types
  • String concatination, indexing and slicing
  • Print and variable assignment operations
  • Arithmetic operations
  • Relational Operations
  • Python functions, scope resolution and return value propagation
  • If/else statements
  • Actual and formal parameters
  • Pass by value parameter transmission
  • Recursion.

An Abstract Syntak Tree (AST) was designed and implemented to represent and interprete Python 2.7.x code. Regression was carried out using a test harness written in python to compare the output of this interpreter with that of Python 2.7.x. Feel free to modify and use this interpreter.

Future work

Update the AST to translate other python language constructs like default parameters, boolean operators, logical and bitwise operators etc.

You can’t perform that action at this time.