Skip to content

Prometheus1400/Radiant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Radiant (Kel)

Radiant is an experimental programming language and compiler frontend written in Go. It currently scans and parses .kel source files, then lowers the AST to LLVM IR (.ll).

Current capabilities

  • Lexing and parsing for core language constructs:
    • variable declarations (let)
    • functions (fn), parameters, and returns
    • conditionals (if / elif / else)
    • expressions, unary/binary operators, and function calls
  • Basic type tokens (number, string, bool, char) with simple pointer syntax (* / &)
  • LLVM IR generation (written to build/example.ll)
  • External printf declaration for output from generated code

This project is still in active development and many language features are not implemented yet.

Repository layout

  • src/main.go – entrypoint (REPL/file execution flow)
  • src/scanner – tokenizer
  • src/parser – Pratt parser + statement parsing
  • src/ast – AST node definitions
  • src/llvm – LLVM IR generator
  • resources/*.kel – sample source files
  • internal/generator.go – codegen utility for AST boilerplate

Prerequisites

  • Go 1.22+
  • LLVM 17 available on your system (go-llvm bindings are used)

On Apple Silicon with Homebrew, these environment variables are commonly needed:

export LLVM_CONFIG="/opt/homebrew/opt/llvm@17/bin/llvm-config"
export PATH="/opt/homebrew/opt/llvm@17/bin:$PATH"

Running

Run the compiler

go run -tags=llvm17 ./src
  • With no args: starts the REPL.
  • With a file arg: compiles that file.

Example:

go run -tags=llvm17 ./src ./resources/scratch1.kel

Generated IR is written to:

build/example.ll

Helper scripts

  • ./run.sh – run compiler with llvm17 build tag
  • ./build.sh – build binary into build/
  • ./generate.sh – regenerate AST boilerplate from internal/generator.go

Example Kel program

fn main() {
    let num = 10;
    let numAddr = #
    printf("number %f has address %p", num, numAddr);
    return;
}

See resources/ for more examples.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors