Related articles |
---|
Using inherited attributes within a yacc grammar crpalmer@undergrad.math.uwaterloo.ca (1994-11-25) |
Re: Using inherited attributes within a yacc grammar al@nmt.edu (1994-11-30) |
Re: Using inherited attributes within a yacc grammar ruiter@ruls41.fsw.leidenuniv.nl (1994-12-01) |
Re: Using inherited attributes within a yacc grammar sikkema@hio.tem.NHL.NL (Albert Sikkema) (1994-12-01) |
Re: Using inherited attributes within a yacc grammar peter@merlion.zfe.siemens.de (1994-12-02) |
Re: Using inherited attributes within a yacc grammar al@nmt.edu (1994-12-02) |
Re: Using inherited attributes within a yacc grammar pjj@cs.man.ac.uk (1994-12-05) |
Newsgroups: | comp.compilers |
From: | pjj@cs.man.ac.uk (Pete Jinks) |
Summary: | you can always convert to synthesised attributes |
Keywords: | yacc, attribute |
Organization: | Dept of Computer Science, University of Manchester, U.K. |
References: | 94-11-167 |
Date: | Mon, 5 Dec 1994 14:31:27 GMT |
I don't know if this helps, but the Dragon book says that any grammar with
inherited attributes can be converted into one with synthesised attributes.
e.g.:
number : digit {$$.base= 10; $$.value= $1;}
| 'x' digit {$$.base= 16; $$.value= $2;}
| number digit {$$.base= $1.base; $$.value= $1.value*$1.base+$2;}
;
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.