Hacker News new | ask | show | jobs
by pjmlp 4583 days ago
Given that one of my CS specialization areas was compiler design, me too.

I implemented a left recursive parser in x86 Assembly for MS-DOS systems.

As I said, yacc and lex are nice to have, but nowadays there is little incentive to keep using them.

Specially as you say, they are not able to parse all types of languages.

1 comments

Did something similar in 6800 assembly, left recursion of course limits you even more - but it helps fit that tiny tiny compiler into 2k.

I actually like yacc/bison - they're good for most purposes and deliberately designing a non-LALR (or more a non-LR) language on purpose (rather than because you don't know any better) is usually silly - you do need to 'get' the concept of building a parse tree from bottom up - assembling it from larger and larger snippets as you go

Oh and yacc/bison run about 10 times faster than equivalent I wrote 10 years before they existed so I'm not complaining

I tend to use the same bespoke lexical analyser I've used for years and hack it to suit - it includes support for symbol tables/etc and runs really fast, no need to reinvent the wheel