[Nickle]Declaring a variable name, replacing previously defined type?

Keith Packard nickle@nickle.org
Fri, 26 Jul 2002 09:38:21 -0700


Around 11 o'clock on Jul 26, Carl Worth wrote:

> Would this be reasonable to support?
> 
> 	> typedef foo;
> 	> int foo;
> 	parse error before "foo"

Not with our current syntax.  Handling typedef-style names requires help 
from the lexer -- each lexed symbol is looked up in the symbol table and 
different tokens returned to the parser depending on the kind of symbol.
It's the same hack that C compilers use because of the limitations of an 
LALR parser.

You can use 'undefine', but that emits an error when the symbol isn't 
currently defined.

Keith Packard        XFree86 Core Team        HP Cambridge Research Lab