Live data from Hacker News

The Super Tiny Compiler

github.com

41–44 of 44 posts

Re: The Super Tiny Compiler

#41
post #29

Earlier quoted context omitted.

For the year 1970 and after: never. This should always be part of the parser for reasons of being confidently correct. Thinking otherwise just leads to suffering. The problem with tutorials like Tiny Compiler or Crafting Interpreters is that the authors do not run into problems with the code shown in their teaching materials, but as soon as a student wants to apply it to modestly complex grammars, it stops working. T…

I am a professional compiler writer and nope you are wrong. I never tokenise everything up front and instead read tokens on demand. It is much faster and enables me to change how tokens are interpreted on the fly. Which enables me to parse different languages with different token definitions in the same file. Something that I need for the production work I do.

>>> when is it useful, if ever, to tokenize the whole input beforehand

>> never

> nope you are wrong. I never tokenise everything up front

Explain how you could possibly arrive at the complete opposite meaning of what I wrote when you even use the same word "never" as I did?

Quick, get another downvote in, that'll teach me! Peak HN moment here.

Re: The Super Tiny Compiler

#42
post #6

Earlier quoted context omitted.

I think most programming languages tokenize first. Tokenizing is absurdly fast, like 100x faster than printing to a terminal.

> Tokenizing is absurdly fast is rather a very good reason to interleave tokenizing and parsing. Otherwise your tokenizer will just get stuck in iowait for no good reason.

Sure, if shaving a millisecond off the execution time of your compiler is your idea of a good time.

Re: The Super Tiny Compiler

#43
post #41

Earlier quoted context omitted.

I am a professional compiler writer and nope you are wrong. I never tokenise everything up front and instead read tokens on demand. It is much faster and enables me to change how tokens are interpreted on the fly. Which enables me to parse different languages with different token definitions in the same file. Something that I need for the production work I do.

>>> when is it useful, if ever, to tokenize the whole input beforehand >> never > nope you are wrong. I never tokenise everything up front Explain how you could possibly arrive at the complete opposite meaning of what I wrote when you even use the same word "never" as I did? Quick, get another downvote in, that'll teach me! Peak HN moment here.

Sorry I clearly misunderstood your point. My bad.

I upvoted your correction.

Post reply on HN