4 ms·
Consider this context sensitive C code: typedef unsigned int uint, uint * uintptr; Here is how to specify a sample grammar to handle the above statement with
by paulbmann 15y ago
Consider this context sensitive C code:
typedef unsigned int uint, uint * uintptr;
Here is how to specify a sample grammar to handle the above statement with a new product called LRSTAR. Note, this grammar has no conflicts and is LALR(1). Here is
the grammar:
<identifier> => lookup ()
Declaration -> VarDecl1 /','... ';'
-> typedef VarDecl2 /','... ';'
VarDecl1 -> Type... <identifier>
VarDecl2 -> Type... <identifier> => defterm(2,{typedef})
Type -> SimpleType...
-> Type '*'
SimpleType -> char
-> int
-> short
-> unsigned
-> {typedef}
You can download LRSTAR at http://HighperWare.com http://HighperWare.com.