Skip to content
/ tre Public
forked from zegl/tre

LLVM backed progamming language (Go subset)

License

Notifications You must be signed in to change notification settings

peter7891/tre

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tre

A LLVM backed Go compiler.

tre is built in Go and can compile a subset of Go code to LLVM IR. Clang is used to compile the IR to an executable.

Building

# Build tre and run a test program
go build -i github.com/zegl/tre/cmd/tre && ./tre tests/tests/fib.tre && ./output-binary

Example

Example program that calculates the fibonacci sequence.

func fib(num int) int {
    if num < 2 {
        return num
    }

    return fib(num-2) + fib(num-1)
}

func main() {
    printf("%d\n", fib(34))
}

More examples of what's possible can be found in the compiler testdata.

Features

Types

  • int
  • string
  • struct
  • array
  • slice
  • map
  • bool
  • func
  • chan

Language features

Dependencies

About

LLVM backed progamming language (Go subset)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.8%
  • Dockerfile 0.2%