lovejoy-lang / ljc

Lovejoy compiler for the ARMv8-A AArch64 instruction set.

Home Page:https://lovejoy-lang.github.io/ljc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ljc

Lovejoy compiler for the ARMv8-A AArch64 instruction set.

C/2014 Q2

Code Documentation

Compiler documentation can be found at lovejoy-lang.github.io/ljc. It may also be compiled and browsed locally, see docs/README.md.

Language Specification

See LANGUAGE_SPEC_DRAFT.md

Compiler Usage

In the root of this repository, run make to build ljc,

$ make

then use the generated binary,

$ ./ljc my-source.lj -o my-binary

Tests

$ make test
$ ./ljc_test

Pipeline

  • Parse with incremental lexing.
  • Macro expansion onto parse tree, spawn new compiler instance for ACE*.
  • Generate HIR, similar to AST, closest to source.
  • Type checking and semantic analysis.
  • Reduce to MIR, mid-level, simplistic closer to machine-code representation.
  • Optimizations (TCO, LICM, etc.)
  • Peephole optimizations.
  • Final translation into ARM machine code.

[Include a graphic here representing pipeline]

Features

Incomplete list of features, most yet to be implemented.

  • Minimal, low-level, simple, C inspired.
  • ACE (Arbitrary Compile-time Execution) (May require implementing a viritual machine, which could also be used for a REPL).
  • Minimal grammar, very few keywords, instead very strong macro system.
  • Pattern matching.
  • Strong type system, with inference, (exact system to be decided).
  • GADTs (Generalized algebraic datatypes), but distinct records and union syntax too (?).
  • Fat pointers.
  • Closures.
  • Overloading.
  • First class types and functions.
  • Generics and higher kinded types.
  • Incremental compilation. (?)
  • Safety features (e.g. nullable v. non-nullable pointers).
  • Integrated build system, build-configuaration to be written in Lovejoy itself. i.e. no scripts, Makefiles, JSON, TOML, YAML, etc.

Future Goals

  • Become self-hosting.

common.h

The common.h and common.c files describe general functions and macros used by this project. For enhanced C syntax highlighting, appropriate to this project, consider using my .vim/after/syntax/c.vim.

About

Lovejoy compiler for the ARMv8-A AArch64 instruction set.

https://lovejoy-lang.github.io/ljc/

License:GNU General Public License v3.0


Languages

Language:C 91.0%Language:C++ 4.0%Language:Makefile 4.0%Language:Shell 1.0%