Skip to content

andrewchambers/qmbfc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qmbfc

qmbfc is a brainfuck compiler written in the Myrddin programming language. qmbfc emits QBE intermediate assembly, which is then translated to x86_64 assembly via the qbe backend executable.

lmbfc

This is a port of qmbfc which emits llvm IR contributed by Quentin Carbonneaux (The author of qbe). It serves as a good comparison of the minimum essentials of emitting llvm or qbe IR directly as text.

Building

(Only tested on linux)

Install myrddin from source and then run in the project directory:

$ mbld

You should then have two binaries ./qmbfc and ./lmbfc corresponding to the qbe and llvm versions of the binary.

Running the compilers

You must have llvm and qbe to run either version of the compiler.

For example, to execute the qbe version and run the compiled binary.

./qmbfc < examples/mandlebrot.bf > mandlebrot.ssa && qbe < mandlebrot.ssa > mandlebrot.s && gcc mandlebrot.s && ./a.out

To execute the llvm version and run the compiled binary.

./lmbfc < examples/mandlebrot.bf > mandlebrot.llvm && llc < mandlebrot.llvm > mandlebrot.s && clang mandlebrot.s && ./a.out

Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published