Live data from Hacker News

Let's Build a Compiler

generalproblem.net

11–20 of 48 posts

Re: Let's Build a Compiler

#11
post #2

We live in a world were ever PC has at least 2 Gbyte of ram and most CPU's are 64 bits, the section 'Data Representation' begins to explain how 'everything' can be stored in a single 32-bit integer, if we limit integers to 30 bits. What the hack?

Generating 64-bit code would be simpler in many ways, but I decided not to go into it until the basic language features are put in place. The extent of the changes involved in switching to amd64 will help directly show why having an intermediate representation for the generated code would be valuable.

Besides, if you're looking for a high-performance Scheme that fully utilizes all available system resources, there are definitely better options available. :)

Re: Let's Build a Compiler

#12
post #9
post #4

Earlier quoted context omitted.

As Bill Gates was alleged to have said "640k ought to be enough for anybody."

He did not say that, sorry.

But he did say we wouldn't likely see speeds in excess of 64kbps. I save that article for decades, still have it somewhere in a filing cabinet, even though it's been scrubbed from the internet.

He was referencing the limitations of copper POTS, of course. But I still found it funny (if I recall correctly, it was printed side-by-side with his debunking of the 'you only need so much ram' quote).

Re: Let's Build a Compiler

#14
post #8

Earlier quoted context omitted.

Most CPUs are 8-bit with 32-bit beginning to take over. They usually don't have more than 256K.

Most CPUs aren't in self-hosting systems.

Yes they are. Embedded applications outnumber top end computers by an order of magnitude.

Re: Let's Build a Compiler

#15

Haven't started reading yet, but I'm really digging this trend of syntax-highlighted bare text blogs[0]. Is this a template or is it hand-crafted? [0]: https://christine.website/blog/h-language-2019-06-30

Currently I'm using a modified version of the after-dark[0] theme for Zola.

[0] https://www.getzola.org/themes/after-dark/

Re: Let's Build a Compiler

#16

Haven't started reading yet, but I'm really digging this trend of syntax-highlighted bare text blogs[0]. Is this a template or is it hand-crafted? [0]: https://christine.website/blog/h-language-2019-06-30

The website seems to be using a template [0], and the CSS is a framework [1].

[0]: https://github.com/getzola/after-dark [1]: https://github.com/egoist/hack

Re: Let's Build a Compiler

#19
This looks like something similar to Crenshaw's excellent tutorial of the same name:

https://compilers.iecc.com/crenshaw/

and its x86 port: https://github.com/lotabout/Let-s-build-a-compiler

As interesting as Lisp-family languages are, I still think it's better to use something with more traditional syntax and start with parsing, because that both reaches a much wider audience and gives a very early introduction to thinking recursively --- the latter being particularly important for understanding of the process in general. A simple expression evaluator, that you can later turn into a JIT and then a compiler, is always a good first exercise.

Re: Let's Build a Compiler

#20
post #9

Earlier quoted context omitted.

He did not say that, sorry.

But he did say we wouldn't likely see speeds in excess of 64kbps. I save that article for decades, still have it somewhere in a filing cabinet, even though it's been scrubbed from the internet. He was referencing the limitations of copper POTS, of course. But I still found it funny (if I recall correctly, it was printed side-by-side with his debunking of the 'you only need so much ram' quote).

64kbps was a limitation of old analog phone lines, which were pretty noisy and also also operated at a pretty low frequency (they only allowed up to a certain frequency, anything beyond was clipped on old analog lines). In practice, dont know that I saw anything beyond 56k. And you could only get that on a clean line, near a switching station. My self, not sure I ever saw much beyond 48k, maybe occasionally 52k, but dont think I ever saw a dialup connection hit the full 56k.

Higher speeds werent possible until moving to digital lines (64k for IDSN, single line, 128k for dual). DSL upped the anty, pushing to 1-3 Mbps in my area. Cable really pushed it when I could get 15 Mbps vs best available DSL in my area at around 3 Mbps.

Today, I have around 200 Mbps over cable (gigabit is available), best DSL in the area is still around 25 Mbps. Fiber is not available yet, but AT&T is running fiber, but 2 years in, still not an option and they haven't published pricing/speeds for the area.

Post reply on HN