[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lexer and syntax highlighter powered by LPeg
- From: Dave Dodge <dododge@...>
- Date: Tue, 10 Apr 2007 11:54:21 -0400
On Fri, Apr 06, 2007 at 01:15:05PM +0100, Andy Stark wrote:
> It's been commonplace for compilers to be self-hosting for some time (BCPL
> was the first, I think). The Java compiler is written in Java, C# written
> in C# and Perl 6 (if it ever materialises) is designed the same way. The
> bootstrapping problem must be surmountable somehow.
Sure, as long as you're willing/able to write the first implementation
in some other language, or find some way to build up to it from
simpler implementations.
For example I recently wrote a self-hosted PEG parser generator,
similar to yacc but based around a C PEG library. To bootstrap it I
hand-coded a C version. The hand-coded version makes heavy use of
macros so that the code is easy to compare against the original
design -- which definitely helped when debugging and making adjustments
to the parsing rules.
-Dave Dodge