Giter Site home page Giter Site logo

sysy-cargo-template's Introduction

基于 Cargo 的 SysY 编译器项目模板

该仓库中存放了一个基于 Cargo 的 SysY 编译器项目的模板, 你可以在该模板的基础上进行进一步的开发.

该仓库中的 Rust 代码实现仅作为演示, 不代表你的编译器必须以此方式实现. 如你需要使用该模板, 建议你删掉所有 Rust 源文件, 仅保留 Cargo.toml 和必要的目录结构, 然后重新开始实现.

事实上, 基于 Cargo 的编译器项目并不需要模板. 不过为了保持和 sysy-make-template 以及 sysy-cmake-template 的一致性, 此处还是开放一个模板项目吧.

你只需要使用如下命令:

cargo init --bin

即可在任意目录初始化一个基于 Cargo 的 Rust 项目, 该项目无需进行任何额外的修改, 即可被评测平台正确编译.

使用方法

注意: 通常情况下, 建议你不要使用本模板, 而直接使用 cargo init 初始化 Cargo 项目.

首先 clone 本仓库:

git clone https://github.com/pku-minic/sysy-cmake-template.git

进入仓库目录后执行:

cargo run -- -koopa input.c -o output.koopa

Cargo 将自动构建并运行该项目.

如在此基础上进行开发, 你需要重新初始化 Git 仓库:

rm -rf .git
git init

然后将自己的编译器的源文件放入 src 目录.

评测平台要求

当你提交一个根目录包含 Cargo.toml 文件的仓库时, 评测平台会使用如下命令编译你的编译器:

cargo build --manifest-path "Cargo.toml的路径" --release

默认情况下, 你无需进行任何更改, 只需要确保项目的 manifest 文件名为 Cargo.toml 即可.

sysy-cargo-template's People

Contributors

maxxsoft avatar

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.