Closed Larsouille25 closed 1 year ago
When, this issue is closed and the branch 27-aot
merged. Re-enable the CI for mona_fe
and mona_common
.
That works ! I'm not able to use the output in an example with c++, but with objdump, we can dissassemble output.o and we found ->
output.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <foo>:
0: b8 7b 00 00 00 mov $0x7b,%eax
5: c3 ret
So the function foo return 0x7b
so 123
The error is ->
main.cpp:12:27: error: no matching function for call to 'foo'
std::cout << "foo" << foo(3.0, 4.0) << std::endl;
^~~
main.cpp:8:9: note: candidate function not viable: requires 0 arguments, but 2 were provided
int foo();
^
1 error generated.
I think it could be the mangling of function name
This source code
func main()
1
After compiling and linking with gcc output.o
and execute a.out
that works, no error, nothing but it's already that
I'm not very happy with the current, project, I realize that Mona is more a Ahead Of Time compiled programming language than a Just In Time compiled one. So here is the steps to modify Mona to be a AOT compiled one :
[x] Remove all things related to JIT, so the REPL, in
src/driver.rs
.[x]
Move thesrc/main.rs
insrc/bin/main.rs
because later, subcommands will have there own module, in the binary.[x] #28
mona_fe
will be the lexer, parser, token.mona_common
will be all common things like errors.mona_codegen
will be a crate that transform an AST to "LLVM IR".mona_build
mona_compiler
will be the thing that transform the "LLVM IR" to object filesmona
will be the binary, the thing that use all of the other ones to make a project. later on the Garbage Collector will be inmona_mem
ormona_gc
[x] Make a CI for
mona_fe
mona_common
[x] Adding subcommand
bobj
that transform a.mn
to an object file.[x]
#29-> This is for 0.2.0