From: Eric Mahurin Date: 2005-11-05T01:35:52+09:00 Subject: Re: YACC (Was: Re: ruby-dev summary 27393-27541) ------=_Part_33036_14780438.1131122150569 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 11/4/05, daz wrote: > > (1997-11-28) - Chris F Clark > http://compilers.iecc.com/comparch/article/97-11-150 > > "Unfortunately, most parsing systems don't encourage > thinking about parsing as sequences of transformations. > Instead they promote the view of one lexer and one parser." BTW, in my grammar project, I do think of parsing as sequences of transformations. A lexer simply transforms a sequence of characters to a token sequence. A parser transforms a sequence of tokens to an AST (or whatever) sequence. With my system, you could easily make a lexer-free parser (parse directly from characters) or go the other way and add more transformation stages (i.e. a preprocessor). For example, I made a TCL interpreter that required no lexer (the simplicity and no keywords helps a lot). Or on the other extreme, you could envision a C compiler built with a series of transformations: preprocess -> tokenize -> parse -> optimize -> assembly -> machine code. My Grammar classes don't care what type of input and output they make - an extreme unification of lexing, parsing, AST parsing, etc. ------=_Part_33036_14780438.1131122150569--