Giter Club home page Giter Club logo

espresso-interpreter's Introduction

Espresso Interpreter

A Simple interpreter made as my assignment.

Context

This was done for an assignment in University. I had to make a simple interpreter that interpreted a made up scripting language called "Espresso Language". In the end, it became a very basic scripting language interpreter. It had to follow the following:

  • The compiler takes a file (program file) and executes it line by line, so it is more like an interpreter, not a real compiler

Statements

​Each line of a program in Espresso language contains a single statement. There are three types of statements in Espresso language:

  1. ​The​ ​assignment​ ​statement:​ the syntax of an assignment statement is variable = infix-expr. When an assignment statement is executed the 'infix-expr' is evaluate and its value is assigned to the variable.
  2. ​The​ ​input​ ​statement:​ ​the syntax of an input statement is read variable When an input statement is executed the program asks the user to enter an integer and assigns the entered value to the specified variable.
  3. ​The​ ​output​ ​statement:​ ​the syntax of an output statement is print infix-expr When an output statement is executed the infix-expr is evaluate and its value is printed on the screen.

I decided to add a couple extra statements for more functionality:

  • goto 'linenumber' jumps to the given line number
  • if infix-exp <comparison operator> infix-exp checks if comparison between the two infix expressions is true, if so, it executes the given code block within the if statement.

Examples programs are included.

espresso-interpreter's People

Contributors

duecknoah avatar

Watchers

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