loopc

所属分类:编译器/解释器
开发工具:Rust
文件大小:35KB
下载次数:0
上传日期:2020-06-10 09:14:44
上 传 者sh-1993
说明:  LOOP编程语言编译器
(Compiler for the LOOP programming language)

文件列表:
Cargo.lock (16664, 2020-06-10)
Cargo.toml (333, 2020-06-10)
LICENSE (35146, 2020-06-10)
examples (0, 2020-06-10)
examples\double.loop (45, 2020-06-10)
examples\fermat.loop (134, 2020-06-10)
examples\fib.loop (109, 2020-06-10)
examples\main.loop (50, 2020-06-10)
examples\ncr.loop (304, 2020-06-10)
examples\prime.loop (313, 2020-06-10)
examples\tetra.loop (217, 2020-06-10)
grammar.txt (408, 2020-06-10)
src (0, 2020-06-10)
src\codegen (0, 2020-06-10)
src\codegen\llvm.rs (18217, 2020-06-10)
src\codegen\macros.rs (2750, 2020-06-10)
src\codegen\mod.rs (10093, 2020-06-10)
src\lexer (0, 2020-06-10)
src\lexer\mod.rs (13004, 2020-06-10)
src\main.rs (4840, 2020-06-10)
src\parser (0, 2020-06-10)
src\parser\ast.rs (1268, 2020-06-10)
src\parser\mod.rs (8950, 2020-06-10)

# Loopc [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) This is a JIT compiler for the [LOOP programming language](https://en.wikipedia.org/wiki/LOOP_(programming_language)) written in Rust. ## Language The LOOP language is designed so that it computes only the functions that are primitive recursive. Therefore, it is not Turing Complete. A program consists of three diffent elements: * Assignment `xi := xj (+|-) c` * Sequential execution `P1; P2` * Loop `loop xi do p end` ## Running programs To run a program and display its result, you may want to specify input and output variables. An output variable is simply set by the output flag of the compiler. Inputs can be set using a 'start-up' program. ```sh $ loopc x.loop -i "x1 := 5; x2 := 4" -o x1 ``` The above example will run `x1 := 5; x2 := 4` first and then execute the code contained in `x.loop`. By omitting the flags, the compiler will default to `x0` as the output variable. If not set otherwise, variables will be initialized with zero. ## Language extensions The compiler offers simple language extensions that are not defined in the core language set. The following extensions are supported: * Assignment of variables to constants (and arithmetic) * Assignment of variables to other variables (and arithmetic) * Multiplication * Division * Modulo You can disable these extensions by setting the `--strict` flag. ## Compiling from source To compile the source code, a system-wide copy of LLVM must be found within the `PATH`. The version must be compatible with llvm-sys found in the local [Cargo.toml](Cargo.toml) file. See https://crates.io/crates/llvm-sys for more info. If there is a compatible version, just type ```sh $ cargo install ``` ## Contributing Feel free to file issues and send pull requests. Contributions are highly welcome! ## License Copyright (C) 2018 Alexander Koch. Licensed under [GNU General Public License Version 3](LICENSE).

近期下载者

相关文件


收藏者