4 ms·
I still have the idea of writing some kind of a "transpiler" that translate a pythonic language into C. Preferably typed, with sets, dicts and arrays. In my he
by jokoon 6y ago
I still have the idea of writing some kind of a "transpiler" that translate a pythonic language into C. Preferably typed, with sets, dicts and arrays.
In my head, it sounds it would be an easier task to do, since it would still let the C compiler do a lot of the work.
This ideas seem to make sense, but I have no experience with writing parser and dealing with language stuff, and I'm afraid that in practice it might be a bad idea.
The goal being to have a scripting language that is fast to parse, easy to write and runs quickly.
- pfalcon 6y agoWelcome to the club (of Python compiler writers): https://github.com/pfalcon/awesome-python-compilers https://github.com/pfalcon/awesome-python-compilers If you wouldn't like to repeat what many people before did, but would like to do something (potentially) new, feel free to accept my "challenge": https://old.reddit.com/r/Compilers/comments/grfjrb/challenge_for_all_proganalysis_hackers_and/ https://old.reddit.com/r/Compilers/comments/grfjrb/challenge...
- UncleEntity 6y ago> In particular, prove or disprove that this can be done without introducing additional "goto" statements. I'm kind of curious how one would do {loop,if} statements without introducing jumps and/or phi nodes?
- pfalcon 6y agoSSA is entirely about phi nodes. Otherwise, the page at the link above shows an "if" statement without goto's. And if you follow more links there, you'll see a "while" without goto's too. If you're interested in this stuff, I'd suggest to comment on Github/Reddit.
- UncleEntity 6y ago> If you're interested in this stuff... Yeah, for sure. Been (slowly) poking at a JavaScript 3rd Edition grammar which I have the parser and AST built for so now the next logical step is to get the SSA form implemented. Been reading through "Combining Analyses, Combining Optimizations" (and friends) so think that's the route I'm taking since I kind of like Futamura projections as a theory and it seems to fit in well with that. Really need to get over my shorn yak fetish (rewritten my asdl generator like 3 times already) and crack down on this thing but c'est la vie...
- jokoon 6y agoI don't feel competent to do this...
- zoom6628 6y agoNuitka does a fine job compiling python into C.... Maybe want you want or at least something to learn from. The last para sounds like you are looking for freepascal - fast parsing, easy to write, blazing fast execution.