Giter Site home page Giter Site logo

compilerbau-ws17-18's Introduction

compilerbau-WS17-18

Build Status GHC v8.0.1

We're building a compiler. It'll compile things.

More specifically, this compiler will be able to translate a narrow subset of Java to JVM bytecode, taking a scenic tour through all the necessary steps in the form of multiple passes: lexing, parsing, typechecking, codegen'ing and serializing.

Setup

Install using

cabal build && cabal install

Maybe update cabal before using

cabal update && cabal install

Usage

Inside the dist/build/jc dir run ./jc File.java -l logFile

Run ./jc -h for additional information

jc usage

Test Framework

Inside the project directory run

cabal repl test-core

and call main in order to see the tests running.

Gif of test-core repl

Alternatively run cabal test --show-details streaming

The Test-suite contains multiple testfiles:

test/
  - Correct/
    - BitWiseOperation
    - ClassAssign
    - ClassMethods
    - DoWhile
    - EmptyClass
    - EndlessForLoop
    - ForLoop
    - InstanceOf
    - InstanzVariable
    - LocalVariable
    - LogicOperations
    - LogicOperations2
    - MethodArguments
    - MethodCall
    - NewClass
    - OperatorOverloading
    - ShortIf
    - SimpleIf
    - SwitchCase
    - WhileLoop
    - WhileLoopCondition
  - Wrong/
    - Syntax/
      - Arithmetic
      - BraceError
      - ReturnTypeMissing
      - SemicolonMissing
      - TypeMissing
    - Type/
      - InstVarTypeMissmatch
      - MethodCall
      - MultipleReturnType
      - NoReturn
      - ReturnType
      - WrongArgumentType
      - WrongIfComparison

and additional example programs. All example programs are validated with normal java programs (print return from compiled example program).

test/ExampleProgramma
  - Faculty
  - Fibonacci
  - Fibonacci-Loop
  - FloorSquareRoot
  - GaußSum
  - Multiplication
  - Pow
  - Prime

Resources

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.