Giter Club home page Giter Club logo

cminus's Introduction

CMinus

Compiler front-end of CMinus, which is the subset of C language

Usage

See my porject’s requirements for more details.

Build

You need the meet the following prerequisites before the building:

  • JDK: Java is selected as the target programming language.
  • Maven: this project use the maven as the build tool.
  • Antlr: I choose anltr to help us analysis cminus’s syntax.

Firstly, you need to download the project.

git clone [email protected]:Sh-Zh-7/CMinus.git

Enter the project’s directory and generate the extra source files with antlr. Since these files can be auto generated, I didn’t put them in my repo.

antlr4 -o src/main/java/io/github/cminus -package io.github.cminus -Dlanguage=Java -listener -encoding utf-8 -visitor -lib src/main/resources src/main/resources/CMinus.g4

Finally you can use maven to get our package and then execute it. Alias to executing jar is strongly recommended.

mvn package -Dmaven.test.skip=true
alias cminus='java -jar target/cminus-1.0-SNAPSHOT-jar-with-dependencies.jar'

Now you can use cminus to interpret the cminus file (with .cm suffix)!

Try to execute the following command and watch its output!

cminus src/test/resources/examples/example2.cm

Quick Start

I carefully prepare the Github issue-bot for you to test my compiler.

Check this page to see how you can let the issue bot understand your CMinus code.

Note there is also a issue template to guide you how to write the correct issue to test.

The effects are shown below:

License

WTF License

Copyright © 2021 Sh-Zh-7


If you like my project, feel free to give my repo a star! ⭐ ⬆️.

cminus's People

Contributors

sh-zh-7 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

cminus's Issues

[test] CMinus code test

int a[1][2][3];
int a;
int b;

struct A {
	int a;
	struct SB{} k;
    struct SB c;
};
struct B {
	int a;
	struct B c;
};
int cnm(){
    return 0;
}
int func(int a,int b){
    return 0;
}
int nmsl(int a[1],int b);
int nmsl(int a,int a);
int nmsl(int a[1],int b){
    int c[1][2];
    int b;
    int d;
    struct A k;
    int e=k.c;
    int sb=nmsl(0,0);
    b=g;
    return 0;
}
struct B{
    struct B{} a;
};
int main(){
    return 0;
}

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.