Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lochbrunner/chop-compiler
Compiler as a proof of concept for the chop programming language
https://github.com/lochbrunner/chop-compiler
chop compiler
Last synced: 2 days ago
JSON representation
Compiler as a proof of concept for the chop programming language
- Host: GitHub
- URL: https://github.com/lochbrunner/chop-compiler
- Owner: lochbrunner
- License: mit
- Created: 2019-02-17T17:54:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-05T15:04:02.000Z (over 1 year ago)
- Last Synced: 2024-12-06T22:43:32.204Z (about 1 month ago)
- Topics: chop, compiler
- Language: Rust
- Homepage:
- Size: 236 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![GitHub Actions status](https://github.com/lochbrunner/chop-compiler/workflows/unit-test/badge.svg)](https://github.com/lochbrunner/chop-compiler/actions?workflow=unit-test)
[![GitHub Actions status](https://github.com/lochbrunner/chop-compiler/workflows/milestones-ichop/badge.svg)](https://github.com/lochbrunner/chop-compiler/actions?workflow=milestones-ichop)
[![GitHub Actions status](https://github.com/lochbrunner/chop-compiler/workflows/milestones-cchop/badge.svg)](https://github.com/lochbrunner/chop-compiler/actions?workflow=milestones-cchop)
[![GitHub Actions status](https://github.com/lochbrunner/chop-compiler/workflows/trunk-gh-page/badge.svg)](https://github.com/lochbrunner/chop-compiler/actions?workflow=trunk-gh-page)# Reference implementation for chop-lang
This is a reference implementation of [Chop Language](https://github.com/lochbrunner/chop-specs/blob/master/README.md).
See [interactive demo](https://lochbrunner.github.io/chop-compiler/).
## Prerequisites
* [Rust](https://www.rust-lang.org/)
* LLVM Tools```bash
sudo apt install libpython2.7 libxml2 clang llvm-dev
```## Setup
```bash
cargo install --path ichop --force
cargo install --path cchop --force
```## Usage
### Interpret
```bash
ichop
```> Hint: Usage of shebang is also possible.
### Compilation
```bash
cchop-o
```## Milestones
### Core
1. [Interpret MVP](./milestones/1) :heavy_check_mark:
1. [Compile MVP via LLVM](./milestones/2) :heavy_check_mark:
1. [Mathematical operations and build-in functions](./milestones/3) :heavy_check_mark:
1. [Variables](./milestones/4) :heavy_check_mark:
1. [Primitive Types](./milestones/5) :heavy_check_mark:
1. [Objects](./milestones/6)
1. [Functions](./milestones/7)
1. [Code generation from intermediate steps](./milestones/8)
1. [Control flow](./milestones/9)
1. [Arrays and Strings](./milestones/10)
1. [Meta Programming](./milestones/11)
1. [Imports and Exports](./milestones/12)
1. Heap
1. Hooks
1. Enums
1. Iterators and Loops
1. Caching
1. Borrowing (and checks)
1. FFI (foreign function interface)
1. Debugging### Standard Library
1. Container
1. IO## Goal - Self hosted language
* Rewrite compiler and interpreter in chop.
* Adjust and extend the language specs with findings on that way....
Finally solve some of [Graydon Hoare's problems](https://graydon2.dreamwidth.org/253769.html)## Architecture
```text
lexer
parser
generator (deprecated)
specializer
simplifier
exporter
llvm
interpreter
```The steps `parser`, `generator` and `specializer` are working on single statements.
## Useful Tools
Compile C code to LLVM:
```shell
clang -S -emit-llvm
```