mystor / asm-lang

A simple compiler for a basic language written in x86-64 assembly language
9 stars 5 forks source link

Labor of Love, Tool Chains & Done? #1

Open FrankC01 opened 8 years ago

FrankC01 commented 8 years ago

First off -- BRAVO!

I've been using it as a tutorial for my own endeavors.

Curious about your thoughts w.r.t. raw iron approach (in your case) vs. using something like a LLVM tool chain for bootstrapping.

Finally, do you plan to keep this going?

Frank

mystor commented 8 years ago

I think that the LLVM toolchain is a much better mechanism for writing a language, and getting familiar with making compilers. That's how I first familiarized myself with compilers. For me this project was most about learning system calls and assembly, which is why I wrote it without using any libraries and in raw assembly code.

Yes, I plan to keep it going, but I've been crazy busy with the last few weeks of class recently and just haven't had the time to make any real progress. I'll probably get back to it and finish up the compiler to actually generate complete-ish programs in a month or so.

FrankC01 commented 8 years ago

Yeah, I understand the busy part. Good to hear you intend to keep going.

I'm currently in the "let's start with a calculator" with a new language (functional). The tool chain I'm running this for initial pass is:

  1. Clojure w/instaparse - Lex->Parse->Syntactical Analysis->AST-> C++ code
  2. Compile/link using g++ (I have my own run-time libraries written in assembler)

Step 2:

  1. Clojure w/instaparse - Lex->Parse->Syntactical Analysis->AST-> LLVM assembler
  2. LLVM->native assembler
  3. NASM compile
  4. Link using g++

At that point I will broaden the grammar and output to generate a Generation 0 compiler!

All the while being ridiculed by my friends