Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #3619 > unrolled thread
| Started by | John R Levine <johnl@taugh.com> |
|---|---|
| First post | 2025-01-09 09:18 -0500 |
| Last post | 2025-01-23 15:54 -0500 |
| Articles | 15 — 8 participants |
Back to article view | Back to comp.compilers
Paper: Developing a Modular Compiler for a Subset of a C-like Language John R Levine <johnl@taugh.com> - 2025-01-09 09:18 -0500
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language OrangeFish <OrangeFish@invalid.invalid> - 2025-01-11 09:15 -0500
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language OrangeFish <OrangeFish@invalid.invalid> - 2025-01-12 16:15 -0500
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language antispam@fricas.org - 2025-01-16 13:46 +0000
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language Salvador Mirzo <smirzo@antartida.xyz> - 2025-01-20 08:38 -0300
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language OrangeFish <OrangeFish@invalid.invalid> - 2025-01-20 11:17 -0500
Re: lecture notes on compilers, was Paper: Developing a Modular Compiler Fernando Magno Quintao Pereira <pronesto@gmail.com> - 2025-01-21 13:33 -0300
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language George Neuner <gneuner2@comcast.net> - 2025-01-21 19:44 -0500
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language OrangeFish <OrangeFish@invalid.invalid> - 2025-01-23 20:49 -0500
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language George Neuner <gneuner2@comcast.net> - 2025-01-25 19:07 -0500
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-01-23 13:56 -0800
Re: Books on writing a compiler, was Paper: Developing a Modular Compiler antispam@fricas.org - 2025-01-21 12:01 +0000
Re: Books on writing a compiler, was Paper: Developing a Modular Compiler antispam@fricas.org - 2025-01-21 18:45 +0000
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language George Neuner <gneuner2@comcast.net> - 2025-01-21 19:54 -0500
Re: Paper: Developing a Modular Compiler for a Subset of a C-like Language Dmitri Volkov <dmitri.s.volkov@gmail.com> - 2025-01-23 15:54 -0500
| From | John R Levine <johnl@taugh.com> |
|---|---|
| Date | 2025-01-09 09:18 -0500 |
| Subject | Paper: Developing a Modular Compiler for a Subset of a C-like Language |
| Message-ID | <25-01-004@comp.compilers> |
The authors developed a compiler for a toy language targeting Raspberry Pi using lex and yacc. Nothing very new but it shows how you build a compiler incremntally expanding the source language. https://arxiv.org/abs/2501.04503 Regards, John Levine, johnl@taugh.com, Taughannock Networks, Trumansburg NY Please consider the environment before reading this e-mail. https://jl.ly
[toc] | [next] | [standalone]
| From | OrangeFish <OrangeFish@invalid.invalid> |
|---|---|
| Date | 2025-01-11 09:15 -0500 |
| Message-ID | <25-01-005@comp.compilers> |
| In reply to | #3619 |
On 2025-01-09 09:18, John R Levine wrote: > The authors developed a compiler for a toy language targeting Raspberry Pi > using lex and yacc. Nothing very new but it shows how you build a > compiler incremntally expanding the source language. > > https://arxiv.org/abs/2501.04503 I wish that they had proofread the pdf before posting. Various pieces of yacc/lex code are missing. OF. [It's just a draft and the authors' actual contact addresses are on that web page. How about writing to them and asking them to put in the missing code? People update arXiv papers all the time. -John]
[toc] | [prev] | [next] | [standalone]
| From | OrangeFish <OrangeFish@invalid.invalid> |
|---|---|
| Date | 2025-01-12 16:15 -0500 |
| Message-ID | <25-01-008@comp.compilers> |
| In reply to | #3620 |
On 2025-01-11 09:15, Our Moderator suggested: > [It's just a draft and the authors' actual contact addresses are on that > web page. How about writing to them and asking them to put in the > missing code? People update arXiv papers all the time. -John] Thank you for the suggestion. As I double-checked the pages, I discovered that it was my Lexmark at fault. So I converted from PDF 1.7 to PDF 1.3 and it printed in its entirety. OF. [That's strange. They try not to do anything clever when generating the PDFs. -John]
[toc] | [prev] | [next] | [standalone]
| From | antispam@fricas.org |
|---|---|
| Date | 2025-01-16 13:46 +0000 |
| Message-ID | <25-01-010@comp.compilers> |
| In reply to | #3619 |
John R Levine <johnl@taugh.com> wrote:
> The authors developed a compiler for a toy language targeting Raspberry Pi
> using lex and yacc. Nothing very new but it shows how you build a
> compiler incremntally expanding the source language.
>
> https://arxiv.org/abs/2501.04503
I am affraid that the best use of this paper is to forget it.
On one hand presentation is very naive and their "final"
compiler apparently does not handle things handled in ususal toy
compilers. On the other hand their presentation has a lot of
gaps and mistakes, so that a newbie is unlikely to be able to
follow them.
--
Waldek Hebisch
[toc] | [prev] | [next] | [standalone]
| From | Salvador Mirzo <smirzo@antartida.xyz> |
|---|---|
| Date | 2025-01-20 08:38 -0300 |
| Message-ID | <25-01-012@comp.compilers> |
| In reply to | #3623 |
antispam@fricas.org writes: > John R Levine <johnl@taugh.com> wrote: >> The authors developed a compiler for a toy language targeting Raspberry Pi >> using lex and yacc. Nothing very new but it shows how you build a >> compiler incremntally expanding the source language. >> >> https://arxiv.org/abs/2501.04503 > > I am affraid that the best use of this paper is to forget it. > On one hand presentation is very naive and their "final" > compiler apparently does not handle things handled in ususal toy > compilers. On the other hand their presentation has a lot of > gaps and mistakes, so that a newbie is unlikely to be able to > follow them. Would you recommend an equivalent paper or book that addresses these short-comings but maintains the educational spirit of the paper? (It's okay if the architecture is not a popular one.) [Good question. There's the old Let's Build a Compiler which you can find on my web site and some books. Alan Holub wrote a well known book but the code in the book is incredibly buggy so I wouldn't recommend it. -John]
[toc] | [prev] | [next] | [standalone]
| From | OrangeFish <OrangeFish@invalid.invalid> |
|---|---|
| Date | 2025-01-20 11:17 -0500 |
| Message-ID | <25-01-014@comp.compilers> |
| In reply to | #3624 |
On 2025-01-20 06:38, Salvador Mirzo wrote: > Would you recommend an equivalent paper or book that addresses these > short-comings but maintains the educational spirit of the paper? (It's > okay if the architecture is not a popular one.) > [Good question. There's the old Let's Build a Compiler which you can find > on my web site and some books. Alan Holub wrote a well known book but the > code in the book is incredibly buggy so I wouldn't recommend it. -John] What are expert opinions on Wirth's book Compilerbau (German notwithstanding)? There seem to love-it or hate-it opinions without much substance. (Another question is where to look for how to add debugging information to the output.) OF.
[toc] | [prev] | [next] | [standalone]
| From | Fernando Magno Quintao Pereira <pronesto@gmail.com> |
|---|---|
| Date | 2025-01-21 13:33 -0300 |
| Subject | Re: lecture notes on compilers, was Paper: Developing a Modular Compiler |
| Message-ID | <25-01-018@comp.compilers> |
| In reply to | #3625 |
Hi Salvador, > Would you recommend an equivalent paper or book that addresses these > short-comings but maintains the educational spirit of the paper? (It's > okay if the architecture is not a popular one.) I’ve recently made the lecture notes that I use in the Compiler Construction course available in a book-like format. You can find the PDF here: https://homepages.dcc.ufmg.br/~fernando/classes/dcc053/. The table of contents is also available on that page. These lecture notes primarily focus on constructing a compiler for a purely functional subset of SML/NJ. Most chapters include links to supporting code. However, the full compiler isn’t provided, as I use it as a project assignment. In this project, students develop the compiler in 15 steps, starting with an interpreter for arithmetic expressions and culminating in a RISC-V code generator for a language with anonymous functions (though closure conversion isn’t required in the test cases). Please note that it’s still a work in progress, and feedback is welcome. Kind regards, Fernando
[toc] | [prev] | [next] | [standalone]
| From | George Neuner <gneuner2@comcast.net> |
|---|---|
| Date | 2025-01-21 19:44 -0500 |
| Message-ID | <25-01-022@comp.compilers> |
| In reply to | #3625 |
On Mon, 20 Jan 2025 11:17:21 -0500, OrangeFish <OrangeFish@invalid.invalid> wrote: >What are expert opinions on Wirth's book Compilerbau (German >notwithstanding)? There seem to love-it or hate-it opinions without >much substance. > >(Another question is where to look for how to add debugging information >to the output.) > >OF. The English version is fairly simplistic - an undergrad intro course at best. I haven't seen the German version.
[toc] | [prev] | [next] | [standalone]
| From | OrangeFish <OrangeFish@invalid.invalid> |
|---|---|
| Date | 2025-01-23 20:49 -0500 |
| Message-ID | <25-01-030@comp.compilers> |
| In reply to | #3629 |
On 2025-01-21 19:44, George Neuner wrote: > On Mon, 20 Jan 2025 11:17:21 -0500, OrangeFish > <OrangeFish@invalid.invalid> wrote: > >> What are expert opinions on Wirth's book Compilerbau (German >> notwithstanding)? There seem to love-it or hate-it opinions without >> much substance. >> >> (Another question is where to look for how to add debugging information >> to the output.) >> >> OF. > > The English version is fairly simplistic - an undergrad intro course > at best. I haven't seen the German version. I was suggesting Wirth to answer Salvador Misro's request for "Would you recommend an equivalent paper or book that addresses these short-comings but maintains the educational spirit of the paper?". Is Wirth (in any version) suitable? OF.
[toc] | [prev] | [next] | [standalone]
| From | George Neuner <gneuner2@comcast.net> |
|---|---|
| Date | 2025-01-25 19:07 -0500 |
| Message-ID | <25-01-031@comp.compilers> |
| In reply to | #3633 |
On Thu, 23 Jan 2025 20:49:51 -0500, OrangeFish <OrangeFish@invalid.invalid> wrote: >I was suggesting Wirth to answer Salvador Misro's request for "Would you >recommend an equivalent paper or book that addresses these short-comings >but maintains the educational spirit of the paper?". > >Is Wirth (in any version) suitable? Wirth's books are fine for dipping your toes in the ocean of language implementation. They are pretty well written and they cover the entire compiler from parsing to code generation. However, they are undergrad level at best - I have yet to see Wirth demonstrates any significant optimizations [middle or back end], or any attempt at implementing a functional language. SFAIHS, everything he has written has been about either procedural or OO implementation. [My impression is that the largest difference between old compiler books and the state of the art is that optimization and the analysis that enables it has gotten vastly more sophisticated. Back when the Dragon Book was first written, compilers often had to fit in 64K and if you wanted to keep the intermediate code in memory, you couldn't compile very big programs. -John]
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2025-01-23 13:56 -0800 |
| Message-ID | <25-01-028@comp.compilers> |
| In reply to | #3625 |
OrangeFish <OrangeFish@invalid.invalid> writes:
> On 2025-01-20 06:38, Salvador Mirzo wrote:
>> Would you recommend an equivalent paper or book that addresses these
>> short-comings but maintains the educational spirit of the paper? (It's
>> okay if the architecture is not a popular one.)
>> [Good question. There's the old Let's Build a Compiler which you can find
>> on my web site and some books. Alan Holub wrote a well known book but the
>> code in the book is incredibly buggy so I wouldn't recommend it. -John]
>
> What are expert opinions on Wirth's book Compilerbau (German
> notwithstanding)? There seem to love-it or hate-it opinions without
> much substance.
The English version, "Compiler Construction", is available in free PDF
form at <https://people.inf.ethz.ch/wirth/CompilerConstruction/>.
Compiler Construction
Niklaus Wirth
This is a slightly revised version of the book published by
Addison-Wesley in 1996
ISBN 0-201-40353-6
Zürich, May 2017
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | antispam@fricas.org |
|---|---|
| Date | 2025-01-21 12:01 +0000 |
| Subject | Re: Books on writing a compiler, was Paper: Developing a Modular Compiler |
| Message-ID | <25-01-015@comp.compilers> |
| In reply to | #3624 |
Salvador Mirzo <smirzo@antartida.xyz> wrote:
> antispam@fricas.org writes:
>
>> John R Levine <johnl@taugh.com> wrote:
>>> The authors developed a compiler for a toy language targeting Raspberry Pi
>>> using lex and yacc. Nothing very new but it shows how you build a
>>> compiler incremntally expanding the source language.
>>>
>>> https://arxiv.org/abs/2501.04503
>>
>> I am affraid that the best use of this paper is to forget it.
>> On one hand presentation is very naive and their "final"
>> compiler apparently does not handle things handled in ususal toy
>> compilers. On the other hand their presentation has a lot of
>> gaps and mistakes, so that a newbie is unlikely to be able to
>> follow them.
>
> Would you recommend an equivalent paper or book that addresses these
> short-comings but maintains the educational spirit of the paper? (It's
> okay if the architecture is not a popular one.)
> [Good question. There's the old Let's Build a Compiler which you can find
> on my web site and some books. Alan Holub wrote a well known book but the
> code in the book is incredibly buggy so I wouldn't recommend it. -John]
I like very much old presentation of PL/0 in Wirth book "Algoritms
+ Data Structures = Programs". Unfortunately, it is available in
old edition of the book but missing in newer ones. Presentation is
in Pascal which seem to be unknown to current students. Wirth uses
hand coded LL parser (unlike texts depending on parser generators).
Code generator covers only imaginary stack machine which is
interpreted (one cound instead generate machine code, but Wirth does
not explain this). PL/0 compiler does not cover type-checking, but
there is PL/S which is similar, but shows more realistic language
including types.
Wirth "Compiler Construction" book available on the net contains
examples of Oberon-like compiler, about 20 pages. This is
written in Oberon, which may be a problem.
For compiler course that I gave in the past I developed my own
examples. One is variation on Wirth PL/0, but using flex and
bison for syntax and generating code for x86_64. If interested
see:
/zaj/public_html/kompi2015/pr
and look for links to subdirectories of 'pl0'. Version 1
is just lexical analyzer for 'flex', version 2 contains bison
grammar, version 3 builds a parse tree, version 4 builds
simplified parse tree, version 5 adds a code generator.
There are comments inside, but course was in Polish, so comments
and variable names are in Polish too.
Note: this is phase-by-phase approach. Enlarging language
may be tricky, unless one is subsetting compiler for bigger
language. And even when subsetting, there can be unexpected
dependence: code for expressions may need intermediate variables,
so general expressions and variables naturally appear together
in code generator.
I also made somewhat simpler example 'sk' (reachable from the
URL I gave above). This one trivializes syntax, using one letter
variable names and precedence based parser, but contains
"retargetable" code generator (one version generates normal C,
one i386 code, one multiprecision C).
In the past I fetched several compiler books from the net.
"Compiler Construction; A Practical Approach" by F.J.F. Benders
J.W. Haaring, T.H. Janssen, D. Meffert and A.C. van Oostenrijk
contains simple compiler for toy language called "Inger".
--
Waldek Hebisch
[toc] | [prev] | [next] | [standalone]
| From | antispam@fricas.org |
|---|---|
| Date | 2025-01-21 18:45 +0000 |
| Subject | Re: Books on writing a compiler, was Paper: Developing a Modular Compiler |
| Message-ID | <25-01-019@comp.compilers> |
| In reply to | #3626 |
antispam@fricas.org wrote:
For compiler course that I gave in the past I developed my own
> examples. One is variation on Wirth PL/0, but using flex and
> bison for syntax and generating code for x86_64. If interested
> see:
>
> /zaj/public_html/kompi2015/pr
Oops, I should give a link instead of a filname:
http://fricas.org/~p-wyk4/kompi2015/pr
--
Waldek Hebisch
[toc] | [prev] | [next] | [standalone]
| From | George Neuner <gneuner2@comcast.net> |
|---|---|
| Date | 2025-01-21 19:54 -0500 |
| Message-ID | <25-01-023@comp.compilers> |
| In reply to | #3624 |
On Mon, 20 Jan 2025 08:38:42 -0300, Salvador Mirzo <smirzo@antartida.xyz> wrote: >antispam@fricas.org writes: > >> John R Levine <johnl@taugh.com> wrote: >>> The authors developed a compiler for a toy language targeting Raspberry Pi >>> using lex and yacc. Nothing very new but it shows how you build a >>> compiler incremntally expanding the source language. >>> >>> https://arxiv.org/abs/2501.04503 >> >> I am affraid that the best use of this paper is to forget it. >> On one hand presentation is very naive and their "final" >> compiler apparently does not handle things handled in ususal toy >> compilers. On the other hand their presentation has a lot of >> gaps and mistakes, so that a newbie is unlikely to be able to >> follow them. > >Would you recommend an equivalent paper or book that addresses these >short-comings but maintains the educational spirit of the paper? (It's >okay if the architecture is not a popular one.) >[Good question. There's the old Let's Build a Compiler which you can find >on my web site and some books. Alan Holub wrote a well known book but the >code in the book is incredibly buggy so I wouldn't recommend it. -John] The Racket lanaguage (which is a Scheme variant) has a framework called nanopass designed deliberately for teaching compilers. https://docs.racket-lang.org/nanopass/index.html I don't have URLs for papers (sorry!), but over the years, some groups have written about using nanopass in compiler courses. If Scheme(-like) is not to your liking, the ideas of nanopass have been adopted and implemented in some other languages. Search engines are your friend.
[toc] | [prev] | [next] | [standalone]
| From | Dmitri Volkov <dmitri.s.volkov@gmail.com> |
|---|---|
| Date | 2025-01-23 15:54 -0500 |
| Message-ID | <25-01-026@comp.compilers> |
| In reply to | #3630 |
> On Mon, 20 Jan 2025 08:38:42 -0300, Salvador Mirzo > <smirzo@antartida.xyz> wrote: >> Would you recommend an equivalent paper or book that addresses these >> short-comings but maintains the educational spirit of the paper? (It's >> okay if the architecture is not a popular one.) I went through Jeremy Siek's Essentials of Compilation last year, and found it very effective. Nanopass-based, and there's both Racket and Python versions of the book. I believe it's available on GitHub: https://github.com/IUCompilerCourse
[toc] | [prev] | [standalone]
Back to top | Article view | comp.compilers
csiph-web