Git Product home page Git Product logo

ssyc's Introduction

SSYC

SSYC is an ARM-v7a assembly compiler for SysY written in pure C++17.

Learn about SSYCInstallationGetting started

Learn about SSYC

SSYC, full name slime SysY compiler, is a compiler for C-like language SysY.

Features

  • Ease to use compiler driver
  • Hand written frontend
  • Strong typed IR in SSA form similar to LLVM-IR
  • Minimal standard library for IO, debug and profiling
  • Pretty assembly output

Installation

Requirement

Minimum requirements

  • CMake >= 3.5
  • C++ compiler supporting C++17 standard

Recommended configuration (for test, profiling and use of scripts)

  • Git
  • Clang >= 15.0.0
  • 32-bit standard libraries for C/C++
  • GTest
  • nushell >= 0.78.0
  • fd >= 8.5.3
  • ripgrep >= 13.0.0

Build compiler

git clone https://github.com/zymelaii/SSYC.git
cd SSYC
cmake -B build -S . --install-prefix <install-prefix>
cmake --build build --target install

Generate testcase program

cmake -B build -S . -DBUILD_TEST=ON
cmake --build build --target testcase

Getting started

Usage

$ slimec -h
ARM-v7a assembly compiler for SysY wriiten in C++ 17

Usage: slimec [options] file...

Options:
  -h, --help           Print help information
  -v, --version        Print version information
  --                   Read from stdin
  -E                   Only run the preprocessor
  --lex-only           Only run the lexer
  -S                   Only run preprocess and compilation steps
  --dump-ast           Use the AST representation for output
  --emit-ir            Use the MIR representation for assembler
  -o, --output <file>  Write output to <file>
  -p, --pipe           Always output to stdout
  -O<opt-level>        Specify optimize level [UNCOMPLETE]
  -f<flag>             Provide extra flag [UNCOMPLETE]

ssyc's People

Contributors

zymelaii avatar sevenqi7 avatar skylarkbkb avatar

Stargazers

qimingchu avatar  avatar 小木曾雪菜 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sevenqi7

ssyc's Issues

Potential error in lookahead() in lexical parsing

ls.lookhead() seems to literally just get the next token, and does not check if that token is a comment. This means that any place in the parser where lookhead() is called to check for the next token and perform the corresponding behavior may get an error when it gets an comment token.

For example, parsing the following code produce this bug:

void func(){
func/**/(); //get fault here
}

Parser determines whether the identifier is a function call by whether the next token of the identifier is a left paren by calling ls.lookahead(), and it will be wrong if there is a comment token between identifier and left paren.

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.