GithubHelp home page GithubHelp logo

interpreter's Introduction

Interpreter

Built on python ๐Ÿ˜Š

  • Version Summary:

    • ver0 - Complete (Sample running code in folder)
    • ver1 - Complete (Sample running code in folder)
    • ver2 - Complete (Sample running code in folder)
    • ver3 - Incomplete (Sample code in folder)
  • This interpreter is based on Python Object Oriented Programming and uses autolinking of objects to their functions (saying in lame terms). All the __init__ methods and build methods are used to parse the blocks of code sequentially. The eval method in the above interpreter works similar to python eval method and evaluates the parsed tree/structure of the code.

  • Basic toy language which is parsed and interpreted using python is as follows:

  n:=2;
  a:=n*2+1;
  while n>0 do
  	while a>0 do
  		print("yo ",a);
  		a:=a-1;
  	done;
  	n:=n-1;
  done;
  if a==0 then
  	print("Machaya");
  else
  	print("Kuch nhi machaya");
  fi;
  • Each assignment statement should use := for assignment and contains ; for termination.

  • If-Else Statement:

    • Condition in between if and then
    • Statements in between then and fi
    • fi should be followed by a ;
  • While Statement:

    • Condition in between while and do
    • Statements in between do and done
    • done should be followed by a ;
  • Print Statement:

    • Works same as python print statement and can print multiple arguments at once.
  • Println Statement:

    • println statement can be used to print a new line character just like Java
  • Good Tutorials ๐Ÿ”–:

interpreter's People

Contributors

ag2307 avatar ag-23 avatar

Watchers

James Cloos avatar  avatar

Forkers

ag-23

interpreter's Issues

Implementing Function Call

Version-3 of interpreter lacks full implementation of function call (basic syntax of function call described in code.txt). Code Cleaning can also be done.

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.