Live data from Hacker News

TinyCompiler: A compiler in a week-end

ssloy.github.io

1–10 of 120 posts

Re: TinyCompiler: A compiler in a week-end

#2
I appreciate how wonderfully simple and dependency free this is. More often than not people just want to write a compiler of sorts without bison or yacc, or LLVM, and just convert expressions into assembler or vm-like instructions that _just run_. This is a great starting point for that, and I wish I had something like it 10 years ago.

(Crenshaw's Let's Build a Compiler is an excellent source too if you want to go one step lower and go standard library free, focusing only on function call stacks: https://compilers.iecc.com/crenshaw/)

Re: TinyCompiler: A compiler in a week-end

#7
Funnily enough, wend looks like what fun programming means to me. C like (prefixed types) syntax, strongly typed but without heartaches of pointers, and simple types.

Every features on top of that has either leaky abstractions and/or nightmare scenarios.

That said I'm not claiming the world should run on this type of code. Or should it.

Re: TinyCompiler: A compiler in a week-end

#8
post #3

I don't think one can understand compilers in a "week-end".

Compilers are some of the simplest "complicated" programs out there if you start by throwing yacc/bison/antlr/parser generators in the garbage.

Production compilers are complicated because of the feature set of languages and performance requirements.

You can write a lexer + parser + treewalk interpreter for a simple language in a day if you know what you are doing.

Re: TinyCompiler: A compiler in a week-end

#9
Thanks! I appreciate your discussion of semantic analysis for wend. I've literally just embarked on creating a (yet another) "compiles to JSX" language[0][1]. I'm using ANTLR for my lexer/parser, but I've just hit a point where I can start doing semantic analysis :)

[0]: https://chicory-lang.github.io/

[1]: https://github.com/chicory-lang/chicory

Re: TinyCompiler: A compiler in a week-end

#10
post #8
post #3

I don't think one can understand compilers in a "week-end".

Compilers are some of the simplest "complicated" programs out there if you start by throwing yacc/bison/antlr/parser generators in the garbage. Production compilers are complicated because of the feature set of languages and performance requirements. You can write a lexer + parser + treewalk interpreter for a simple language in a day if you know what you are doing.

5 days if you don't, but have the right tutor.
Post reply on HN