LGE (Lambda g(e)) is a toy functional programming language compiler that I wrote to try out llvm. 🙂
let name: type = (param: type, ...) -> expression
int: 32-bit integerfloat: 32-bit floating pointchar: 8-bit characterstr: C-style stringfunc: Function pointer
str_print(str) -> int: Print string to stdoutstr_read(int) -> str: Read string from stdin (up to n characters)str_len(str) -> int: Get length of stringstr_at(str, int) -> char: Get character at indexstr_sub(str, int, int) -> str: Get substring from start to end indexstr_find(str, str) -> int: Find substring (-1 if not found)int_to_str(int) -> str: Convert integer to stringstr_to_int(str) -> int: Convert string to integerfloat_to_str(float) -> str: Convert float to stringstr_to_float(str) -> float: Convert string to floatstr_cmp(str) -> int: Returns 1 if true
- Comments start with
# - Line continuation with
\
- Linux
- CMake 3.20+
- C++20 compatible compiler
- LLVM 18 development libraries
- Git
- python3 (for running tests)
$> lgec --help
LGE
Usage: lgec [OPTIONS] input_file
Positionals:
input_file TEXT:FILE REQUIRED
Input LGE source file
Options:
-h,--help Print this help message and exit
--dump-tokens Dump lexer tokens to stdout
--dump-ast Dump AST to stdout$> ./lgec tests/examples/hello_world.lge | lli -load=liblge_runtime.so
Hello world!This project is licensed under the MIT License - see the MIT License file for details.