Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crenshaw's "Let's Build a Compiler": Transcription to C and x86 Assembler? [closed]

I am trying to work through Jack Crenshaw's excellent compiler programming tutorial "Let's Build a Compiler" and have bumped into two hurdles. First the code is written in Pascal, a great language for which I have both respect and fondness from a brief exposure to it in the mid 1980s, but which I have not touched since. I currently program mostly in C.

The other hurdle is that the generated assembler is for the Motorola 68000 line of processors. While I may be able to find a translator for it, it would be preferable if I could generate Intel x86 assembler (either Intel or AT&T style).

I can work through the code on Linux, Mac OsX or Windows 7, if it makes anything easier. I have access to all of the named operating systems.

I do not feel fully qualified to do the transcription myself. Has anybody worked this out already, or do you have other suggestions?

Any ideas, feedback or suggestions welcome.

like image 735
haziz Avatar asked May 16 '12 01:05

haziz


2 Answers

You could run the generated code on a 68K emulator—several of the entries on that page are open-source.

like image 67
Lawrence D'Oliveiro Avatar answered Nov 15 '22 06:11

Lawrence D'Oliveiro


It might be easier to target the JVM instead of a native processor. as for translating Pascal to C... it'shouldn't be that much of a hurdle really.

like image 42
James Avatar answered Nov 15 '22 06:11

James