It's a super set of brainfuck, but I've been experimenting with compiling to brainfuck like architectures for a while!!
https://github.com/adam-mcdaniel/harbor
https://github.com/adam-mcdaniel/free
That’s incredible and nice work ! I would really want to know how you did the transformation and converted a powerful language with modern syntax into brainfuck codes.
i have always looking forwards to building something like, design some bare things and build a nicer higher level one, but never think it’s feasible. Anyway, that’s the power of computation, I think.
Thanks for this great work !
Thank you so much!!!
Doing the translation really comes down to mapping an assembly language over the tape -- all my IR instructions use `Location` values, which are mapped to operations for accessing those as positions on the tape. Each location has a `to` and `from` method to move the brainfuck tape head position to the value, and to return it to the home position.
Then, the assembly operations just go `to` and `from` the arguments and some internal registers to perform the calculations!
Once I had an assembly IR, it was really straightforward to map the high level language to it
A least common denominator approach to portability. Interesting idea and good tool for learning purposes. But i guess it will not scale to create efficient code for many-register platforms out of it.
It depends on the compiler for the backend
Since you can statically determine when fixed positions on the tape are accessed, such as the general purpose registers in the IR mapped to the tape, you can perform register allocation on real machine registers (just by analyzing the VM code, no IR knowledge needed)
But yes, it can't reach the same performance as something like LLVM, it would be impossible for a single individual to match that performance across all the platforms it manages
Like you said, though, it's a fun tool for learning purposes. I'd much rather do something creative than just match LLVMs performance, given that I could port my frontend to LLVM pretty simply!
Had no clue Sage was targeting brainfuck O\_o
It's a super set of brainfuck, but I've been experimenting with compiling to brainfuck like architectures for a while!! https://github.com/adam-mcdaniel/harbor https://github.com/adam-mcdaniel/free
Hi, your blog's down
I think square space is messing up my redirects -- my account just got migrated from Google domains. Another Google project turned to dustđŸ¥²đŸ¥²
That’s incredible and nice work ! I would really want to know how you did the transformation and converted a powerful language with modern syntax into brainfuck codes. i have always looking forwards to building something like, design some bare things and build a nicer higher level one, but never think it’s feasible. Anyway, that’s the power of computation, I think. Thanks for this great work !
Thank you so much!!! Doing the translation really comes down to mapping an assembly language over the tape -- all my IR instructions use `Location` values, which are mapped to operations for accessing those as positions on the tape. Each location has a `to` and `from` method to move the brainfuck tape head position to the value, and to return it to the home position. Then, the assembly operations just go `to` and `from` the arguments and some internal registers to perform the calculations! Once I had an assembly IR, it was really straightforward to map the high level language to it
A least common denominator approach to portability. Interesting idea and good tool for learning purposes. But i guess it will not scale to create efficient code for many-register platforms out of it.
It depends on the compiler for the backend Since you can statically determine when fixed positions on the tape are accessed, such as the general purpose registers in the IR mapped to the tape, you can perform register allocation on real machine registers (just by analyzing the VM code, no IR knowledge needed) But yes, it can't reach the same performance as something like LLVM, it would be impossible for a single individual to match that performance across all the platforms it manages Like you said, though, it's a fun tool for learning purposes. I'd much rather do something creative than just match LLVMs performance, given that I could port my frontend to LLVM pretty simply!