antimony-lang/antimony

Imports

garritfra opened this issue · 0 comments

There should be an import keyword that compiles external files and adds them to the symbol tree.

fib.sb

fn fib(n: int): int { 
    if 1 >= n {
        return n
    }
    return fib(n-1) + fib(n-2)
} 

main.sb

import "fib"

fn main() {
    let result = fib(10)

    println(result)
}

Resolving paths

  • Paths should be resolved relative to the current file.
  • File extensions are optional
  • when importing a directory, the path directory/module.sb should be resolved