bfcc
bfcpp
bfcc | bfcpp | |
---|---|---|
4 | 9 | |
18 | 37 | |
- | - | |
0.0 | 0.0 | |
over 3 years ago | almost 2 years ago | |
Go | C | |
GNU General Public License v3.0 only | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
bfcc
-
Ask HN: Guidance on writing a source to source compiler (transpiler)
You could start here:
https://github.com/jamiebuilds/the-super-tiny-compiler
That converts from lisp-like to javascript. Really though this is a big field, and there are lots of resources out there.
To get started look at your input language; you'll need to lex and parse that. Then massage the parsed structure into the appropriate output.
You can see me convert brainfuck to C, or x86 assembly language here:
https://github.com/skx/bfcc
-
I wrote a Brainfuck to Go compiler
Related to this I used go to compile brainfuck to x86 assembly:
https://github.com/skx/bfcc
That was a fun project I challenged myself to complete in a weekend.
-
Show HN: Optimizing brainfuck interpreter using only the C preprocessor
I wrote a simple compiler for brainfuck too:
https://github.com/skx/bfcc
Compiling to assembly language was pretty fast, but folding in repeated characters definitely made it faster still. Optimizing the assembly wasn't a particular goal, I guess recognizing loops that zero addresses, and similar, would be a good way to start.
- What's a good language to write a simple compiler for
bfcpp
-
Better C Generics: The Extendible _Generic
The preprocessor is actually quite fast, as long as you are just doing primitive replacement things. I benchmarked my preprocessor brainfuck interpreter (without optimizations) against a constexpr brainfuck interpreter (without optimizations), and it beat constexpr for interpreting smaller programs. isort4 for example is a brainfuck program that does insertion sort on 45 inputs, and the preprocessor implementation was more than twice as fast as the constexpr one. Larger programs are slower to interpret with the preprocessor, because it always needs to copy the entire program code.
-
Conditional preprocessor macro, anyone?
PS: I wrote a bit of an explanation for my preprocessor brainfuck interpreter, maybe you can learn a few tricks from that: https://github.com/camel-cdr/bfcpp/blob/main/TUTORIAL.md
-
What’s the most “abusive” code you’ve ever written?
Since you mentioned macros: I wrote a brainfuck interpreter using only the preprocessor, so it interprets brainfuck at compile time. The entire thing is a huge abuse of macros: https://github.com/camel-cdr/bfcpp
- I wrote an optimizing brainfuck interpreter using only the C Preprocessor, here is how
- Who needs C++? C preprocessor meta programming is the future.
- Show HN: Optimizing brainfuck interpreter using only the C preprocessor
- Let's write an optimizing Brainfuck interpreter using only the C Preprocessor
What are some alternatives?
the-super-tiny-compiler - :snowman: Possibly the smallest compiler ever
CC - A small, usability-oriented generic container library.