Skip to content

tychobrailleur/my-toy-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is my first attempt at a simple compiler following the Ruby compiler series: https://web.archive.org/web/20080413133022/http://www.hokstad.com/writing-a-compiler-in-ruby-bottom-up-step-2.html

The article however uses x86 assembler, when this is an attempt at generating x64 assembler. I know nothing of x64 assembler, and the code generated is deduced from gcc -S as indicated by the article series. This means that more than likely the code is either suboptimal, or plain incorrect.

The command used to compile is:

ruby compiler.rb > hello.s
gcc -no-pie -o hello hello.s

Docker

docker can be used to compile everything:
cd docker
docker build -t my-compiler .
docker run -it -v $(pwd)/..:/develop my-compiler:latest /bin/bash

Some useful links:

About

Attempt at creating a toy compiler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published