Related articles |
---|
[5 earlier articles] |
Re: Java Comment-Preserving Grammar tbauer@cadrc.calpoly.edu (Tim Bauer) (2004-05-30) |
Re: Java Comment-Preserving Grammar jens.troeger@light-speed.de (2004-06-06) |
Re: Java Comment-Preserving Grammar clint@0lsen.net (Clint Olsen) (2004-06-06) |
Re: Java Comment-Preserving Grammar gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-06-09) |
Re: Java Comment-Preserving Grammar cfc@shell01.TheWorld.com (Chris F Clark) (2004-06-11) |
Re: Java Comment-Preserving Grammar alexc@std.com (Alex Colvin) (2004-06-13) |
Re: Java Comment-Preserving Grammar gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-06-13) |
Re: Java Comment-Preserving Grammar cfc@shell01.TheWorld.com (Chris F Clark) (2004-06-15) |
Re: PL/I syntax, was Java Comment-Preserving Grammar alexc@std.com (Alex Colvin) (2004-06-21) |
Re: PL/I syntax, was Java Comment-Preserving Grammar Peter_Flass@Yahoo.com (Peter Flass) (2004-06-26) |
From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
Newsgroups: | comp.compilers |
Date: | 13 Jun 2004 11:22:36 -0400 |
Organization: | Comcast Online |
References: | 04-05-075 04-06-004 04-06-022 04-06-041 |
Keywords: | Java, parse, comment |
Posted-Date: | 13 Jun 2004 11:22:36 EDT |
Chris F Clark wrote:
(snip)
> In particular, each place a whitespace or comment token is allowed, it
> is almost always optional. Unless your parser generator has been
> extended to support regular expressions (and standard Yacc/Bison is
> not, and prior to about 1985 there were no commonly available LL+RE
> tools and about 1990 no LR+RE tools), you can't express such optinal
> clauses "inline".
(snip)
Maybe it is that languages designed around yacc/bison work
that way? At the time I was thinking about PL/I, where there
are some places where spaces (or comments) are needed to separate
tokens:
DO I=J TO K BY L;
(I believe that comments will also separate them.)
DO/*loop*/I=J/*up*/TO/*the limit*/K/*increment*/BY L;
Then there is Fortran, with no inline comments and where
spaces aren't significant even in the middle of tokens.
assign 1.10 to the variable DO10I:
DO 10 I=1.10
Print out ten numbers:
DO10I=1,10
10 WRITE(6,11) I
But the science of Fortran parsers seems to be well understood.
-- glen
[In most modern languages, whitespace is optional unless the two
tokens next to each other look like one token, e.g. in 2+2 the
whitespace is optional, but in int foo it's not. PL/I has extra
excitement beyond tokenizing because it has no reserved words and
you can write IF IF=THEN THEN IF=ELSE; ELSE IF=THEN; -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.