Giter Site home page Giter Site logo

stella-implementation-in-cpp's Introduction

Stella implementation in C++ (template)

This is the skeleton for a C++ implementation of the Stella programming language interpreter.

Screenshot from VS Code.

Requirements

This was tested with:

  • make 4.1
  • BNFC 2.9.4.1
  • flex 2.6.4
  • bison 3.8.2
  • g++ 11.2.0
  • cmake 3.23.0-rc5
  • ninja 1.8.2

Building and running the interpreter

  1. To build the interpreter run:
make

This typically involves running BNFC converter, and compiling the project in the chosen language, resulting in an executable build/stella-interpreter that you can now use to type check and interpret programs.

  1. Now, to run the type checker:
make typecheck

This starts the type checker waiting to input the program. Note that it will accept input until it encounters the end of file (Ctrl+D).

  1. To run the interpreter:
make interpret <filename>

This starts the interpreter reading the program from the input file and waiting for the input of the argument for the main function.

  1. To run tests:
make test

This will run the tests specified in CMakeLists.txt.

Code Structure

Interpret.cpp is the main file that contains the logic for reading a program and its arguments (if you run an interpreter).

TypeCheck.h and TypeCheck.cpp files assume the content of the type checker logic. Currently they contain only prototypes of the functions for further implementation. The input program from the interpreter is passed directly to the typecheckProgram function.

Eval.h and Eval.cpp files similarly imply the logic of interpreting the program. They also contain only prototypes. The input program (read from the file) and the argument (entered after the interpreter starts) are passed directly to the evalMainWith function.

How to develop

You must extend the existing files to perform the required actions. If you need to add additional files, don't forget to add them to the CMake file (in the SRCS variable) to include them in the build process.

stella-implementation-in-cpp's People

Contributors

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