In scan.l, there is:

decimal (({digit}*\.{digit}+)|({digit}+\.{digit}*))
real 
((({digit}*\.{digit}+)|({digit}+\.{digit}*)|({digit}+))([Ee][-+]?{digit}+))

Could this be simplified as:

decimal (({integer}?\.{integer})|({integer}\.{integer}?))
real ((({decimal})|({integer}))([Ee][-+]?{integer}))

What is the reason if it shouldn't be?  This is just an educational question, 
I guess. I wouldn't want to waste time writing bad patches. :)  I ran regress 
with this change and it looked ok.

One reason I can think of right now, is that if the definition of integer or 
decimal were to change, it might break decimal and real.  Another reason 
might be a performance loss?

-- 
-------- Robert B. Easter  reaster@comptechnews.com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------

Mon, 29 Jan 2001 02:36:06 -0500
"Robert B. Easter" <reaster@comptechnews.com>
scan.l simplifications
"Robert B. Easter" <reaster@comptechnews.com> writes:
> In scan.l, there is:
> decimal (({digit}*\.{digit}+)|({digit}+\.{digit}*))
> real 
> ((({digit}*\.{digit}+)|({digit}+\.{digit}*)|({digit}+))([Ee][-+]?{digit}+))

> Could this be simplified as:

> decimal (({integer}?\.{integer})|({integer}\.{integer}?))
> real ((({decimal})|({integer}))([Ee][-+]?{integer}))

I think it's better style as it stands.  The latter might be fewer
characters but it's not easier to understand (IMHO anyway), because
you have to refer back to more nonterminals to decipher it, and said
nonterminals have meanings much more complicated than digit.

Also, as you noted, it'd link the definitions of integer/decimal/real
in ways that might cause trouble later.

			regards, tom lane

Mon, 29 Jan 2001 10:03:40 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: scan.l simplifications 