cannoli

所属分类:编程语言基础
开发工具:Rust
文件大小:0KB
下载次数:0
上传日期:2018-10-25 23:13:52
上 传 者sh-1993
说明:  Cannoli编程语言
(Cannoli Programming Language)

文件列表:
Cargo.toml (335, 2018-10-25)
LICENSE (1073, 2018-10-25)
resources/ (0, 2018-10-25)
resources/logo/ (0, 2018-10-25)
resources/logo/cannoli_logo_212x118.png (38127, 2018-10-25)
resources/logo/cannoli_logo_512x436.png (118946, 2018-10-25)
resources/logo/cannoli_logo_fullsize.jpg (7849118, 2018-10-25)
resources/logo/cannoli_logo_fullsize.png (3350114, 2018-10-25)
resources/papers/ (0, 2018-10-25)
resources/papers/cannoli-thesis-paper.pdf (299145, 2018-10-25)
src/ (0, 2018-10-25)
src/compiler/ (0, 2018-10-25)
src/compiler/errors.rs (651, 2018-10-25)
src/compiler/local.rs (513, 2018-10-25)
src/compiler/mod.rs (53474, 2018-10-25)
src/compiler/util.rs (943, 2018-10-25)
src/lexer/ (0, 2018-10-25)
src/lexer/errors.rs (3209, 2018-10-25)
src/lexer/iter.rs (4020, 2018-10-25)
src/lexer/mod.rs (54751, 2018-10-25)
src/lexer/tokens.rs (10804, 2018-10-25)
src/lib.rs (156, 2018-10-25)
src/main.rs (1040, 2018-10-25)
src/parser/ (0, 2018-10-25)
src/parser/ast.rs (5519, 2018-10-25)
src/parser/errors.rs (2586, 2018-10-25)
src/parser/mod.rs (78812, 2018-10-25)
src/parser/util.rs (7901, 2018-10-25)
test_suite/ (0, 2018-10-25)
test_suite/cannoli (23, 2018-10-25)
test_suite/microbenchmarks/ (0, 2018-10-25)
test_suite/microbenchmarks/bench01/ (0, 2018-10-25)
test_suite/microbenchmarks/bench01/info.txt (66, 2018-10-25)
test_suite/microbenchmarks/bench01/test.py (4462, 2018-10-25)
test_suite/microbenchmarks/bench02/ (0, 2018-10-25)
test_suite/microbenchmarks/bench02/info.txt (55, 2018-10-25)
... ...

# Cannoli Programming Language ![](https://github.com/joncatanio/cannoli/blob/master/resources/logo/cannoli_logo_212x118.png) Cannoli is a compiler for a subset of Python 3.6.5 and is designed to evaluate the language features of Python that negatively impact performance. Cannoli is written in [Rust](https://github.com/joncatanio/cannoli/blob/master/https://www.rust-lang.org/) and also compiles Python to Rust. The use of Rust as the intermediate representation was chosen for performance purposes and to avoid writing a garbage collector. Cannoli was developed as work for a Master's Thesis at [Cal Poly - San Luis Obispo](https://github.com/joncatanio/cannoli/blob/master/https://www.calpoly.edu/). ### Python Support Cannoli supports a subset of Python 3.6.5, its current state omits many features that could not be completed during the duration of the thesis. The main omissions are exceptions and inheritance. Standard library support is also incomplete but covers numerous proofs-of-concepts that could be applied to other types and modules (see [Cannolib](https://github.com/joncatanio/cannoli/blob/master/#cannolib)). ### Optimizations Cannoli supports two major optimizations that come as a result of applying restrictions to the language. Restrictions are placed on the Python features that provide the ability to delete or inject scope elements and the ability to mutate the structure of objects and classes at run time. The corresponding feature branches are [`scope-opts`](https://github.com/joncatanio/cannoli/blob/master/https://github.com/joncatanio/cannoli/tree/scope-opts) and [`class-opts`](https://github.com/joncatanio/cannoli/blob/master/https://github.com/joncatanio/cannoli/tree/class-opts). The optimizations are built on top of each other, therefore the `class-opts` branch is a superset of the `scope-opts` branch. In general, the `class-opts` branch yields a performance increase of over 50% from the `master` branch. ### Thesis Paper More information on the results and implementation details of Cannoli can be found in the thesis paper. :point_right: _[Leave the Features: Take the Cannoli](https://github.com/joncatanio/cannoli/blob/master/https://digitalcommons.calpoly.edu/theses/1886/)_ - Jonathan Catanio ### How to Run - Install Rust by following the instructions on their official [installation guide](https://github.com/joncatanio/cannoli/blob/master/https://www.rust-lang.org/en-US/install.html). Cannoli is both compiled with Rust 1.24.0 and outputs Rust 1.24.0 code. Changing versions with the Rust toolchain can be done with the `rustup` utility. - Build the project by running `cargo build` or `cargo build --release` in the project's root directory. This will create a `target` directory with `debug` or `release` subdirectories containing the executable. - Compile a Python file by executing the command `./target/release/cannoli [src.py]` ### Executing the Compiled Python Compiling with Cannoli outputs a `main.rs` file that can be used in a standalone Rust crate. Ideally the Cannoli compiler would utilize `rustc` to output a binary but this wasn't done. The steps on how to run this compiled file are as follows: - Create a new crate with the command `cargo new --bin sandbox`. Where `sandbox` is the name of the crate. - Move the `main.rs` file into the new crate's `src` directory. - Update the `Cargo.toml` file to include `cannolib` as a dependency, this is Cannoli's standard library. This can be done by linking to a git repository or to a relative crate. ``` [dependencies] cannolib = { git = 'https://github.com/joncatanio/cannolib', branch = 'master' } ``` Would include the master branch of the Cannolib git repo in the crate. - To add debugging and all optimizations to release mode, also include these lines in the `Cargo.toml`: ``` [profile.release] debug = true codegen-units = 1 ``` - Finally, build the project from the crate's root directory with `cargo build --release` and run the executable with the command `./target/release/sandbox`. ### Cannolib [Cannolib](https://github.com/joncatanio/cannoli/blob/master/https://github.com/joncatanio/cannolib) provides library support for Cannoli, including a number of types and modules that offload work that would have otherwise been done by the Cannoli compiler. Cannolib provides the implementation of the overall type system as well as built-in functions similar to those defined in the [Python library](https://github.com/joncatanio/cannoli/blob/master/https://docs.python.org/3/library/functions.html#built-in-functions).

近期下载者

相关文件


收藏者