Coder Social home page Coder Social logo

compiler-ocaml's Introduction

This repo is created for a school project.

To run and test the compiler : ocamlbuild Main.byte -- tests/Test_fonction.mjava

Project structure :

1. Typer:
1.1 Typing/Env.ml This file creates the typing environment, which contains two environments: env_cl -> used to store and type class, methods and attributes of class env_vl -> used to store and type local variable. env_cl is refreshed each time when a method is called

1.2 Typing/Typer.ml This file typies an AST tree step by step, firstly add class name to Env.ml, then set class parent, then type attributes and finally type methods of the class

1.3 Typing/ExprTyper.ml This file is a part of Typer.ml, which focuses on typing expressions (give type to expression)

2. Compilation
2.1 Compiling/EnvHeap.ml This file creates a virtual heap(tas) to store all class informations. Since the type is already testet in typer part, we ignore the type of each varaible. To store an attribute, we use its name, its belonging class name and its expression_desc. To store a method, we use its name, its belonging class name, its inside expression, and its arguments' name (name's value will replace variable in body expression)

2.2 Compiling/Compilation.ml Add all classes and its attributes and methods to EnvHeap.ml

3. Evaluation (Basic Functions)

compiler-ocaml's People

Contributors

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