Skip to content

pointertobios/olang-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Olang Compiler

LLVM-based programming language compiler

Build

mkdir build && cd build
cmake .. && make -j$(nproc)

Snake Game Example

cd build
./olc ../examples/src/snake.olang -o ../examples/build/snake.o
cd ..
./olang-link ./examples/build/snake ./examples/build/snake.o -lncurses -lc

./example/build/snake

Controls: ↑↓←→ arrow keys to move, q to quit

Compiler (olc)

Usage: ./build/olc <input_file> [options]
Options:
  --emit-llvm       Generate LLVM IR (.ll)
  -o <output>       Specify output file
  --target <triple> Specify target triple
  --print-ir        Print LLVM IR to stdout

Default: Generate object file (.o)
Linking: Use ld.lld or clang to link .o files

Linker

./olang-link <output> <input.o> [-lc ...]

Language Features

  • Basic types: i1, i8, i16, i32, i64, f32, f64
  • Structs and arrays
  • Functions: internal, extern declarations, export
  • Control flow: if/else, while
  • Operators: arithmetic, comparison, logical
  • Pointers

Dependencies

  • C++17
  • CMake 3.20+
  • LLVM 18
  • Java (ANTLR)
  • ld.lld

About

an example of compiler implement for olang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •