Skip to content

Compiler as a proof of concept for the chop programming language

License

Notifications You must be signed in to change notification settings

lochbrunner/chop-compiler

Repository files navigation

GitHub Actions status GitHub Actions status GitHub Actions status GitHub Actions status

Reference implementation for chop-lang

This is a reference implementation of Chop Language.

See interactive demo.

Prerequisites

sudo apt install libpython2.7 libxml2 clang llvm-dev

Setup

cargo install --path ichop --force
cargo install --path cchop --force

Usage

Interpret

ichop <code filename>

Hint: Usage of shebang is also possible.

Compilation

cchop <code filename> -o <output filename>

Milestones

Core

  1. Interpret MVP ✔️
  2. Compile MVP via LLVM ✔️
  3. Mathematical operations and build-in functions ✔️
  4. Variables ✔️
  5. Primitive Types ✔️
  6. Objects
  7. Functions
  8. Code generation from intermediate steps
  9. Control flow
  10. Arrays and Strings
  11. Meta Programming
  12. Imports and Exports
  13. Heap
  14. Hooks
  15. Enums
  16. Iterators and Loops
  17. Caching
  18. Borrowing (and checks)
  19. FFI (foreign function interface)
  20. Debugging

Standard Library

  1. Container
  2. 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

Architecture

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:

clang -S -emit-llvm <c code file>

About

Compiler as a proof of concept for the chop programming language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published