Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
/ lemur-lang Public archive

A compiled object-oriented programing language

Notifications You must be signed in to change notification settings

avramdj/lemur-lang

Repository files navigation

Lemur

A compiled object-oriented programing language implemented with ANTLR4 and LLVM-12.

CMake

Syntax

class Base {
    float x
    string message
    
    def Base(float x) {
        this.x = x
    }
    def setMessage(string s) {
        message = s
    }
    def incX() {
        x = x + 1
    }
    def getX() : int {
        return x
    }
    def doSomething() : int {
        return x*x
    }
}

class Derived <- Base {
    int y
    def doSomething() : int {
        return x*y
    }
}

def main() {
    Base b = Derived()
    
    b.setMessage("We did it!")

    while(b.getX() < 10) {
        if(b.getX() < 5) {
            print("Not there yet...")
        } else {
            print("Keep going!")
        }
        b.incX()
    }
    print(b.getMessage())
}

Types

Statically typed.

Weakly typed.

Objects are passed by reference.

Built-in types: int, float, bool, string

Dependencies

  • LLVM-12
  • CMake

Build

  • cmake CMakeList.txt
  • make

Run

  • ./lemur source_file | llc -o out_name

TODO

  • AST class hierarchy
  • antlr parser and lexer
  • AST builder
  • hook up llvm backend
  • unit testing
  • string support
  • type infrastructure
  • better scoping
  • advanced OOP concepts
  • garbage collector
  • JIT support

About

A compiled object-oriented programing language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published