c2lang / c2compiler

the c2 programming language
c2lang.org
Apache License 2.0
702 stars 47 forks source link

TODO with source line number? #112

Closed luarockr closed 2 years ago

luarockr commented 4 years ago

Sometimes receiving compiler error like

building target rcrpg Exit due to TODO in /Projects/c2/c2compiler/c2c/Analyser/LiteralAnalyser.cpp:205:checkLiterals() << Not sure if it is possible, but maybe it would be helpful to see the originating source line number to figure out if a workaround for not implemented features in the compiler are possible?

bvdberg commented 4 years ago

I think that might indeed be nice. I don't think it's too hard to implement. I'll look into it..

bvdberg commented 4 years ago

Can you share the code you were trying to build? Maybe I can just fix the TODO instead of extending it..

luarockr commented 4 years ago

here you go, please don't judge, I am just playing around by porting some C code (this one from Rosetta Code) to C2 for getting familiar with syntax, etc ;-)

rcrpg.c2.txt recipe.txt

bvdberg commented 4 years ago

cool a game! that makes debugging a lot more fun ;)

bvdberg commented 4 years ago

I fixed one issue in c2c. These mainly have to do with AliasTypes. I almost never use them, so they are a bit under-tested. I modified the random() function to remove the float. That bypasses that limitation of c2c now. Now you're back to plain old compile errors... Please pull and rebuild.. rcrpg.c2.txt

luarockr commented 4 years ago

Had some issues compiling it after llvm updated and forgot a z3 dependency ... unfortunately the new c2 is still running into the TODO in /Projects/c2/c2compiler/c2c/Analyser/LiteralAnalyser.cpp:205:checkLiterals()

bvdberg commented 4 years ago

With the updated rcrpg.c2.txt I added in my last post?

luarockr commented 4 years ago

oh, sorry, tried with my old one, missed that attachment. with the one you provided works better, now I can continue porting the C to C2. Thanks a lot :-)