Hey whats up, TI community?? Everybody busy learning ez80?

Because whatever you do, you might want to have a look at this:

Funk compiler converts the left code to the right one!

Is this amazing or just shit, pls let me know Smile
Looks like I don't have to learn ASM after all!
Interesting, but it looks like all variable bindings must refer directly to registers, which would imply it tends to be more of a lexical substitution than really useful compiler. Given that, it seems like proper high-level thinking would be pretty difficult.

Maybe I'm missing something though. Technical details would certainly be interesting to pore over.
Although a screenshot is worth a thousand posts, to some people lazier than I, a webpage isn't worth a single Google search.
To these lazy people, here you go:
Ha, well it is mostly register replacement and parameter usage, but there could be more, until total register hiding. But I wanted to support manual register handling, too. The code is a bit funky and for now compiles with VisualStudio2012 as I havent tested it on other platforms, but it is C++.

Since I'm a library-on-top guy, I'd really like to integrate with FunkLibrary and SPASM more. The features of the compiler (it's not really a compiler, is it?) are:
- definition of nestable modules
- definition and calling of functions, auto naming to "module.module.(...).function"
- definition of register aliases in function parameters "name: register" or on the fly "name = register"
- usage of aliases without no further checks (for now!)
- implicit definition of strings
- addition, indirection
- simple if condition with register a (for now)

To be added:
- register scoping, saving, magic
- loops
- flags
- more operators: minus, multiply, bit shifting
- instruction set check (can't do "ld d, (de)")
- you name it
Alright this looks awesome. I think this is more of a transpiler then a compiler.
I'd love to see some more documentation of the language syntax, but that can wait until you feel it's closer to a point where people can start using it.
Adding return values Smile .

fn mul2(value: a) -> result: c
   result = a + a

fn testMul2()
   val: a = mul2(5)


;  a = value
;  c = result
   add   a, a
   ld   c, a

   ld   a, 5
   call   mul2
   ld   a, c
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum