Skip to content

Commit

Permalink
feat: Added default import to base.les
Browse files Browse the repository at this point in the history
  • Loading branch information
alinalihassan committed May 6, 2022
1 parent df1ba9a commit 09c0d70
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/liblesma/Backend/Codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Codegen::Codegen(std::unique_ptr<Parser> parser, const std::string &filename, bo
isMain = main;

TopLevelFunc = InitializeTopLevel();

// If it's not base.les stdlib, then import it
if (std::filesystem::absolute(filename) != getStdDir() + "base.les") {
CompileModule(Span{{0, 0}, {0, 0}}, getStdDir() + "base.les", true);
}
}

llvm::Function *Codegen::InitializeTopLevel() {
Expand Down
5 changes: 5 additions & 0 deletions src/std/base.les
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def extern printf(x: str)

def print(x: str)
printf(x)
printf("\n")
1 change: 0 additions & 1 deletion src/std/time.les
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#ret=101
def extern usleep(x: int)

def sleep(x: float)
Expand Down

0 comments on commit 09c0d70

Please sign in to comment.