Skip to content

kiansahafi/Compiler_Project_University

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini_Java Compiler Project 👨‍💻

University of Zanjan

Professor: Dr. Leila Safari

Project Description 📝

This project, developed as part of the Compiler class at the University of Zanjan, encompasses various phases of compiler construction, each building upon the previous one. The goal is to create a compiler for a language known as Mini_Java, which is a subset of Java with specific syntactic restrictions. Here's an overview of the project phases:

Project Phases 🚀:

  1. Lexical Analysis of Language Manual 📖: In this phase, we perform lexical analysis on the Mini_Java language manual to understand its structure and rules.

  2. Lexical Analysis using the Lexer Tool 🧮: Leveraging the Lexer Tool, we conduct lexical analysis to tokenize and recognize language constructs in Mini_Java source code.

  3. Syntactical Analysis using Yacc 🧾: Utilizing Yacc, we move on to syntactical analysis, parsing Mini_Java source code to create a syntax tree.

  4. Semantic Analysis 🧠: This phase involves semantic analysis to ensure the correctness of Mini_Java programs.

  5. Intermediate Code Generation 🌐: The final phase focuses on generating intermediate code from the parsed Mini_Java source.

Mini_Java Language Overview 📚:

The Mini_Java language is a subset of Java with specific syntactic restrictions, ensuring that every Mini_Java program is a legal Java program with Java semantics. Key highlights of Mini_Java include:

Simple classes without nesting or inheritance. Basic members: fields and methods. Limited primitive types: void, int, boolean. Arrays: int[] and class[] (class is any class type). Supported statements: block, assignment, method invocation, if, while. Expressions include basic operations, logical, and relational operations. Our project aims to develop a compiler that can handle Mini_Java source code adhering to these specifications.

Lexical Rules 🧐

The lexical rules define the structure of Mini_Java tokens and include identifiers (id), integer literals (num), operators (binop and unop), and more. Whitespace and comments are also recognized. The grammar and terminal symbols are outlined in the provided grammar section.

Getting Started 🏁

This project serves as a valuable learning experience in compiler construction. You can explore each phase, understand the Mini_Java language specifications, and delve into the world of compiler development.

Usage 🧪

Feel free to use the provided code and information for educational purposes, further compiler research, or as a reference for your own projects.

Contributing 🤝

Contributions to this project are welcome. If you're interested in compiler development or have ideas for improvements, feel free to contribute.

About

Project for Compiler in University of zanjan

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published