Giter Site home page Giter Site logo

simple-compiler-and-stack-machine's Introduction

Simple Compiler & Stack Machine (C++)

These two C++ applications can compile and run a simple dummy language. The compiler recursively compiles the language (.s) and creates an abstract stack machine code (.m). Then this abstract stack machine code is run by the stack machine.

The grammar of the simple language can be found in the PDF document.

Getting Started

After compiling the both .cpp files you can run them on the test files provided.

Prerequisites

You need to have GNU (Gnu is not Unix) Open Source compiler installed in order to compile the source files.

Installing

If GNU (Gnu is not Unix) Open Source compiler is installed, you can run the application using the steps below.

First compile Compiler.cpp with g++ compiler.

g++ Compiler.cpp -o Compiler.o

Execute Compiler.o with an .s file. Output will be an .m file.

./Compiler.o prime.s

Then compile StackMachine.cpp with g++ compiler.

g++ StackMachine.cpp -o StackMachine.o

Execute StackMachine.o with an .m file. Output will be displayed on console.

./StackMachine.o prime.m

For prime.m, big numbers are displayed in scientific notation. For all syntax errors, compiler gives an error and terminates compiling except the case that where a file does not have 'end'.

Deployment

You can just run the executable files on the input files.

Built With

  • g++ - The language used

Authors

simple-compiler-and-stack-machine's People

Contributors

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