Recent

Author Topic: Tutorial on creating a compiler  (Read 20714 times)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Tutorial on creating a compiler
« Reply #90 on: January 09, 2020, 05:24:21 pm »
For completeness sake, a rather nice book (thanks to this post by Ñuño): Robert Nystrom's Crafting Interpreters.

This caught my atention at once:
Quote from: Crafting Interpreters
[...] this text is lighter on theory than others. As we build each piece of the system, I will introduce the history and concepts behind it. I’ll try to get you familiar with the lingo so that if you ever find yourself in a cocktail party full of PL (programming language) researchers, you’ll fit in.

But we’re mostly going to spend our brain juice getting the language up and running. This is not to say theory isn’t important. Being able to reason precisely and formally about syntax and semantics is a vital skill when working on a language. But, personally, I learn best by doing. It’s hard for me to wade through paragraphs full of abstract concepts and really absorb them. But if I’ve coded something, run it, and debugged it, then I get it.

That’s my goal for you. I want you to come away with a solid intuition of how a real language lives and breathes. My hope is that when you read other, more theoretical books later, the concepts there will firmly stick in your mind, adhered to this tangible substrate.
(emphasis mine)
« Last Edit: January 09, 2020, 05:27:36 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Tutorial on creating a compiler
« Reply #91 on: January 09, 2020, 05:46:38 pm »
Thanks for the cross-posting, which gets everything usefully in one place.

MarkMLl


MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

JdeHaan

  • Full Member
  • ***
  • Posts: 115
Re: Tutorial on creating a compiler
« Reply #92 on: January 09, 2020, 06:02:12 pm »
Bob Nystrom explains very clearly the step by step creation of an interpreter (in Java) and compiler (in C). I used his text to create an interpreter in Free Pascal (https://github.com/jdehaan2014/GearLanguage ), and now busy to translate his C-code into FP for the compiler part.
He also wrote an article on Pratt parsers :
http://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Tutorial on creating a compiler
« Reply #93 on: January 10, 2020, 04:42:04 am »
Thanks for the cross-posting, which gets everything usefully in one place.
Adding the links below, we'll have an overview of recent useful extra information:

Best Tutorial
https://forum.lazarus.freepascal.org/index.php/topic,45078.0.html

Wiki stub: Make your own compiler, interpreter, parser, or expression analyzer
https://forum.lazarus.freepascal.org/index.php/topic,42556.0.html

Book recommendation on programming language concepts and design ?
https://forum.lazarus.freepascal.org/index.php/topic,42156.0.html

Books on building an object oriented compiler
https://forum.lazarus.freepascal.org/index.php/topic,47844.0.html

Books and Articles on building a debugger
https://forum.lazarus.freepascal.org/index.php/topic,48075.0.html

Standard Pascal ISO 7185:1990 and Extended Pascal ISO/IEC 10206:1991
https://forum.lazarus.freepascal.org/index.php/topic,47587.0.html

Modula, Oberon or Ada
https://forum.lazarus.freepascal.org/index.php/topic,47800.0.html

A suggestion for a new FPC feature
https://forum.lazarus.freepascal.org/index.php/topic,45832.0.html

P65Pas a new 6502 Pascal compiler
https://forum.lazarus.freepascal.org/index.php/topic,42408.0.html

Midnight trolling: Don't take everything serious!
https://forum.lazarus.freepascal.org/index.php/topic,48033.0.html

 

TinyPortal © 2005-2018