Products > Programming

Wonderful Tutorial For Writing Interpreters/Compilers

(1/2) > >>

Omega Glory:
I've been trying to learn how to write a compiler for a custom CPU I made, when I came across this incredible series of blog posts on creating a Pascal interpreter from scratch. It covers lexing, parsing, semantic analysis, scope resolution, and much more. The code is written in Python, and everything is much more readable than similar tutorials I've seen online. This was too good not to share: https://ruslanspivak.com/lsbasi-part1/

bobcat2000:
Oh This is good.  So much memory taking this class in school.  I think I got an A on this class.
My first calculator program written in C using a Stack... Good Time!!!

https://www.amazon.com/Compilers-Principles-Techniques-Alfred-Aho/dp/0201100886/ref=sr_1_1?crid=3MH2S7KFSSXMN&keywords=%E2%80%8E+978-0201100884&qid=1640159400&s=books&sprefix=978-0201100884%2Cstripbooks%2C265&sr=1-1

DiTBho:

--- Quote from: Omega Glory on December 12, 2021, 03:38:24 pm ---I've been trying to learn how to write a compiler for a custom CPU I made

--- End quote ---

Assembly compiler?
For a "C--" or "C" compiler, the best reference (in my opinion) is LCC.
It has a good book, and good sources.

SiliconWizard:
It's hard not to mention Wirth's "Compiler construction": https://people.inf.ethz.ch/wirth/CompilerConstruction/index.html

Omega Glory:

--- Quote from: DiTBho on December 22, 2021, 12:36:31 pm ---Assembly compiler?
For a "C--" or "C" compiler, the best reference (in my opinion) is LCC.
It has a good book, and good sources.

--- End quote ---

Well I've written an assembler for my CPU, so I'm planning on having my compiler generate assembly. That way it might be a little easier to debug instead of going straight to hex. Hmm, I've heard of the Tiny C Compiler, but not the Little C Compiler. I'll check that out. My idea is to come up with a very simple high level language, but it will probably be similar to C.


--- Quote from: bobcat2000 on December 22, 2021, 07:51:21 am ---Oh This is good.  So much memory taking this class in school.  I think I got an A on this class.
My first calculator program written in C using a Stack... Good Time!!!

https://www.amazon.com/Compilers-Principles-Techniques-Alfred-Aho/dp/0201100886/ref=sr_1_1?crid=3MH2S7KFSSXMN&keywords=%E2%80%8E+978-0201100884&qid=1640159400&s=books&sprefix=978-0201100884%2Cstripbooks%2C265&sr=1-1

--- End quote ---

Ah yes, the Dragon book. I have heard a lot of good things about that. I don't own a copy now because of the price, but maybe I should bite the bullet. (edit: I should have looked harder. There are a few used ones for a good price).


--- Quote from: SiliconWizard on December 22, 2021, 06:54:53 pm ---It's hard not to mention Wirth's "Compiler construction": https://people.inf.ethz.ch/wirth/CompilerConstruction/index.html

--- End quote ---

Thank you very much! That looks very good!

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod