[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lexer and syntax highlighter powered by LPeg
- From: "Andy Stark" <AStark@...>
- Date: Fri, 06 Apr 2007 13:15:05 +0100
Lua list <lua@bazar2.conectiva.com.br> writes:
>Andy Stark wrote:
>> Would it be feasible/desirable for a future version of Lua to use PEG
>> techniques (coded in C) in its own parser?
>What advantage would that bring? The Lua parser works already, right?
Yes, I noticed that too ;-)
Well, as I understand it, PEGs allow you to specify both lexical and
syntactic patterns, so there wouldn't need to be a separate lexer and
scanner in the parser. I'm thinking a PEG system might make the code
easier to understand and modify. Maybe also smaller code size and speed
for the parser? Both are very important for Lua.
>There would certainly be some bootstrapping problems since LPeg uses Lua
>operators to compose patterns :). I know of a language which bootstraps
>itself with some minimal operators but I can't seem to find it right now.
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.
&.
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by MailMarshal.
The Blackpool Sixth Form College.
#####################################################################################