Skip to content

EduRibeiro00/JMMCompiler-feup-comp

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

COMP Class Assignments and Projects

2019/2020 - 3rd Year, 2nd Semester

Course: Compiladores (COMP) | Compilers

Projects developed by: David Silva (daviddias99), Eduardo Ribeiro (EduRibeiro00), Luís Cunha (luispcunha) and Manuel Coutinho (ManelCoutinho)


Project: JMM Compiler

  • The tool built serves as a compiler of .jmm files, written in the Java-- language, a subset of the Java language. All programs that are valid in the Java-- language are also valid in the Java language.
  • The compiler generates files of the classes with JVM instructions accepted by jasmin, a tool that translates those classes in Java bytecodes (classfiles). The generated classes given Java-- code can be integrated in a Java application. Those classes can invoke Java methods previously compiled to bytecodes.
  • The process of generating the instructions and the .j file from the .jmm file is divided in several phases: the compiler first performs a lexical and syntactic analysis to the code, matching tokens and expressions to check the validity of the code. This, among other things, generates the abstract syntax tree (AST) of the program. Next, a semantic analysis of the program is performed, catching some types of errors that could not be detected in the previous analysis. A syntax table is generated in this phase. Next, comes the code generation phase, where the compiler, based on the AST and symbol table previously created, generates the code for jasmin to interpret. This code will be stored in a .j file. The compiler also has implemented a series of optimizations that improve the quality of the code generated and the program that originates from it, as well as the overall performance of the compiler.
  • Languages/technologies used: Java, JavaCC, jasmin.

Grade: 19.64 / 20


Disclaimer - This repository was used for educational purposes and I do not take any responsibility for anything related to its content. You are free to use any code or algorithm you find, but do so at your own risk.

About

Code and projects developed in the COMP subject throughout the semester (MIEIC 3rd year, 2nd semester).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •