Skip to content

Gaomengkai/Jrabche

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jrabche

Description

A Java implementation of the Vrabche

An Vrabche is a compiler for Sysy language, which is a subset of C language. It can compile Sysy source code into RISC-V and ARMv7 assembly code.

The Vrabche author is GammaMilk, which is a group of students from Huazhong University of Science and Technology, including

,lead by Gao Mengkai.

Java Implementation

This project is a Java implementation of the Vrabche.

At first, this project is to be submitted as a competition in 全国计算机系统能力大赛(全国赛区).

Dependencies

Build Steps

This project was built with Maven.

  • download source code
  • make sure you have installed Maven
  • run mvn clean install -DskipTests in the root directory of the project, in order to install the dependencies and generate Lexer and Parser
  • run mvn package -DskipTests in the root directory of the project, in order to generate the executable jar file

optional

  • run mvn test in the root directory of the project, in order to run the test cases

Run

This project is a command-line tool.

You can run the jar file with the following command:

java -jar target/jrabche-1.0-SNAPSHOT-jar-with-dependencies.jar [options] [source file]

while the options are:

  • -o [output file]: specify the output file
  • -S [riscv|arm]: specify the target architecture
  • -O [0-3]: specify the optimization level
  • -h: show the help message
  • -v: show the verbose message

Test

This project uses JUnit5 as the test framework.

The test cases are in the src/test/java directory.

If you want to run the test cases, make sure you have installed:

  • clang
  • mingw-w64(if windows)

Now, only the front-end test cases are available. And the cases were all passed.

(IMPORTANT) If you wanna test on your own, please modify the config file:

src/test/java/icu/merky/jrabche/fe/visitor/FETestConfig.java

Progress

  • Lexical Analysis
  • Syntax Analysis
  • Semantic Analysis
  • IR Generation
  • IR Optimization
  • Instruction Selection
  • Instruction Scheduling
  • Register Allocation
  • Code Generation
  • Test Front-end
  • Test Optimizer
  • Test Back-end
  • Jar Released

About

Vrabche impl by java.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages