Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

It's hard to think of you as the end result of millions of years of evolution.


devel / comp.compilers / How can I get my act together on the backend of this compiler?

SubjectAuthor
* How can I get my act together on the backend of this compiler?luser droog
`* Re: How can I get my act together on the backend of this compiler?Hans-Peter Diettrich
 `- Re: How can I get my act together on the backend of this compiler?luser droog

1
How can I get my act together on the backend of this compiler?

<21-10-039@comp.compilers>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=128&group=comp.compilers#128

  copy link   Newsgroups: comp.compilers
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From: luser.dr...@gmail.com (luser droog)
Newsgroups: comp.compilers
Subject: How can I get my act together on the backend of this compiler?
Date: Fri, 22 Oct 2021 17:58:16 -0700 (PDT)
Organization: Compilers Central
Lines: 35
Sender: news@iecc.com
Approved: comp.compilers@iecc.com
Message-ID: <21-10-039@comp.compilers>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
logging-data="37746"; mail-complaints-to="abuse@iecc.com"
Keywords: code, question
Posted-Date: 22 Oct 2021 21:43:01 EDT
X-submission-address: compilers@iecc.com
X-moderator-address: compilers-request@iecc.com
X-FAQ-and-archives: http://compilers.iecc.com
 by: luser droog - Sat, 23 Oct 2021 00:58 UTC

I've been working (playing) off and on with code for doing
parser combinators in C. And I filled it out with a K&R C
tokenizer and syntax analyzer so it produces as CST.
Some extra tree trimming and other gyrations to smooth
it out into something more like a usable AST.

And then I don't know what I'm doing anymore. I don't know
where best to study up to figure out how to write a
super amazing code generation backend that's fancy and
cryptic and short like I like.

Since the code itself is kinda stealing from FP literature,
I've been advised to look into "pattern matching" as an
appropriate FP technology to power my "middle end".
(My last question here was asking about how to power
my middle end.) And that has led to this article, which
kinda looks like exactly what I want...

https://arxiv.org/pdf/1210.3593.pdf
Ondˇrej B ́ılka, Pattern matching in compilers. Prague 2012

And I've also put down the Forth books and picked up
good old Budge, /Recursive Programming Techniques/ 1975,
for my lunch breaks. A sort of proto-SICP AFAICT.

Is there anywhere else I should be looking for inspiration
for a really concise and elegant way to write and organise
the tree-walking code-generation code? Or is this paper
the thing, and I'm just not seeing it yet?

I hope this is technical enough for the forum, despite being
somewhat vague and unconstructive. Hoping the experts
here can give me a kick in the right direction.

-- droog

Re: How can I get my act together on the backend of this compiler?

<21-10-040@comp.compilers>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=129&group=comp.compilers#129

  copy link   Newsgroups: comp.compilers
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From: DrDiettr...@netscape.net (Hans-Peter Diettrich)
Newsgroups: comp.compilers
Subject: Re: How can I get my act together on the backend of this compiler?
Date: Sat, 23 Oct 2021 05:07:05 +0200
Organization: Compilers Central
Lines: 10
Sender: news@iecc.com
Approved: comp.compilers@iecc.com
Message-ID: <21-10-040@comp.compilers>
References: <21-10-039@comp.compilers>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
logging-data="46282"; mail-complaints-to="abuse@iecc.com"
Keywords: code
Posted-Date: 24 Oct 2021 17:26:48 EDT
X-submission-address: compilers@iecc.com
X-moderator-address: compilers-request@iecc.com
X-FAQ-and-archives: http://compilers.iecc.com
In-Reply-To: <21-10-039@comp.compilers>
 by: Hans-Peter Diettrich - Sat, 23 Oct 2021 03:07 UTC

On 10/23/21 2:58 AM, luser droog wrote:

> And then I don't know what I'm doing anymore. I don't know
> where best to study up to figure out how to write a
> super amazing code generation backend that's fancy and
> cryptic and short like I like.

A look at the Lua interpreter may be helpful.

DoDi

Re: How can I get my act together on the backend of this compiler?

<21-11-001@comp.compilers>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=130&group=comp.compilers#130

  copy link   Newsgroups: comp.compilers
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From: luser.dr...@gmail.com (luser droog)
Newsgroups: comp.compilers
Subject: Re: How can I get my act together on the backend of this compiler?
Date: Fri, 12 Nov 2021 18:18:18 -0800 (PST)
Organization: Compilers Central
Lines: 37
Sender: news@iecc.com
Approved: comp.compilers@iecc.com
Message-ID: <21-11-001@comp.compilers>
References: <21-10-039@comp.compilers> <21-10-040@comp.compilers>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
logging-data="8076"; mail-complaints-to="abuse@iecc.com"
Keywords: code, practice
Posted-Date: 12 Nov 2021 22:27:27 EST
X-submission-address: compilers@iecc.com
X-moderator-address: compilers-request@iecc.com
X-FAQ-and-archives: http://compilers.iecc.com
In-Reply-To: <21-10-040@comp.compilers>
 by: luser droog - Sat, 13 Nov 2021 02:18 UTC

On Sunday, October 24, 2021 at 4:26:51 PM UTC-5, Hans-Peter Diettrich wrote:
> On 10/23/21 2:58 AM, luser droog wrote:
>
> > And then I don't know what I'm doing anymore. I don't know
> > where best to study up to figure out how to write a
> > super amazing code generation backend that's fancy and
> > cryptic and short like I like.
> A look at the Lua interpreter may be helpful.
>
> DoDi

Thanks. I read up on some "internals" documents and it does look really
interesting. A sliding register window over the more basic stack. 3-address
opcodes eliminating a lot MOV and LOAD instructions. A lot of this may
be directly applicable if I target something like Forth.

But it may be that I'm not ready for the backend because of the lingering
unsolved issues with the frontend. So, I've been making some progress
on a new prototype that may ease the backend effort later on. At least,
the new one will be able to give error messages instead of simply not
producing output. And that feels very important and useful.

At the same time, Budge seems like exactly what I was after. All the tricks
from SICP (probably) with less jibber jabber. If you squint through the SKI
stuff you can see that simple "ideal" compiler I was trying to imagine.
This dude explains control structures by showing how to compile them.
He doesn't even get to parsing input for 2 more chapters. All lambdas all
the way down.

With any luck I'll have the prototype fleshed out with a few examples and
then rewritten in C in a few weeks/months. *Then*, maybe I'll be able to
do a backend. At least a draft to iterate on. Wish me luck. (A silent
luckwishing is acceptable.) Thanks for your patience, everyone. I'll be back
with actual interesting content when it's ready.

droog

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor