Akuli / jou

Yet another programming language
MIT License
11 stars 4 forks source link

Support import file from other folder? #389

Closed littlewhitecloud closed 1 year ago

littlewhitecloud commented 1 year ago
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         2023/4/29      8:17                alib
-a----         2023/4/29      8:30             78 test.jou

alib/func.jou

import "stdlib/io.jou"

def helloworld() -> void:
    printf("Hello World!")

test.jou

import "alib/func.jou"

def main() -> int:
    helloworld()
    return 0

I want:

Hello World!

But:

compiler error in file "test.jou", line 1: import path must start with 'stdlib/' (standard-library import) or a dot (relative import)
littlewhitecloud commented 1 year ago

Think should work on parse_import

Akuli commented 1 year ago

Jou's syntax is explicit, so you need import "./alib/func.jou" where . means the current directory.