Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 648 Bytes

README.md

File metadata and controls

18 lines (12 loc) · 648 Bytes

8cc.tex

This is a TeX source of 8cc built on ELVM. In other words, this is a complete C compiler written in TeX.

This was very influenced by 8cc.vim.

Usage

printf \\000 | cat sample/hello.c - | od -A n -t d1 -w1 -v | tex 8cc.tex # compile C code to ELVM IR.
echo 0 | cat 8cc.tex.elvm.out - | tex elc.tex
cat elc.tex.elvm.out | xargs printf "%03o\n" | xargs -I_ printf \\_ > hello.tex # compile ELVM IR to TeX source.
tex hello.tex # execute
cat hello.tex.elvm.out | xargs printf "%03o\n" | xargs -I_ printf \\_ # show stdout