Giter Club home page Giter Club logo

mcjavacompiler's Introduction

Project root : MCJavaCompiler/ Project have 5 directories

  • Absyn : Node classes for AST
  • ErrorMsg : Unused now
  • Compile : This directory has 'Main' class for entire compiler execution/
  • Parse : Frontend class for Compile.Main class to execute, and lexer/parser classes.
  • Symbol : Symbol, symbol table, and its interfaces
  • libs : It has library files, JFlex and CUP.

Building the project 'Makefile' contains build sequence. You can build the whole project by 'make' command.

Executing the MiniC parser Execute the main java class with CUP library on root directory of the project. 'libs' directory already contains CUP library, so you just need this command.

java -cp libs/java-cup-11a.jar: Compile/Main

This command execute parser with '/input.txt' as input.

You can pass another file as an argument of the parser.

java -cp libs/java-cup-11a.jar: Compile/Main your_test_file

Replace 'your_test_file' to anything you want.

At the end of parsing, parser generates 2 files as a result. One is "tree.txt", which is miniC code from visiting AST. Another is "table.txt", symbol table for given code.

Type Analysis Compiler does type analysis, and it prints a modified AST when input program is correctly typed. Type analysis prints list of error like following.

[Error/Warning] Line , :

Modified AST's have type conversion, int to float, or float to int. You can see casting expressions like C in a modified AST as result.

mcjavacompiler's People

Contributors

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