y-flat / yfc

The best (because it's the only) compiler for the Y-flat programming language.
GNU General Public License v3.0
6 stars 7 forks source link

Generated C doesn't compile properly #112

Closed adamhutchings closed 2 years ago

adamhutchings commented 2 years ago
yfc tests/sem/return-good.yf 
Error: yfc: Compilation command failed
dekrain commented 2 years ago

That's because there's no main function. If you look at jobs output

% ../../cmake/yfc return-good.yf --dump-commands
ANALYSE (COMPILE) file=return-good.yf prefix=(null) syms=(null) out=return-good.c
COMPILE (COMPILE) file=return-good.yf prefix=(null) syms=(null) out=return-good.c
"/usr/bin/clang" "-c" "return-good.c" "-o" "return-good.o"
"/usr/bin/clang" "return-good.o" "-o" "a.out"
Error: yfc: Compilation command failed

It's actually the linking that failed, not C compilation

dekrain commented 2 years ago

It would be best to write a specific error message to tell that linking failed.

adamhutchings commented 2 years ago

Absolutely. I’m going to fix this along with the other issue with main function prefixing.