Re: WANTED: stylistic advice/guidelines for YACC and LEX

Scott Stanchfield <scooter@mccabe.com>
29 Jan 1996 17:45:30 -0500

          From comp.compilers

Related articles
WANTED: stylistic advice/guidelines for YACC and LEX timd@Starbase.NeoSoft.COM (1996-01-27)
Re: WANTED: stylistic advice/guidelines for YACC and LEX scooter@mccabe.com (Scott Stanchfield) (1996-01-29)
Re: WANTED: stylistic advice/guidelines for YACC and LEX rmonroe@hever.demon.co.uk (Robert F. Monroe) (1996-01-31)
Re: WANTED: stylistic advice/guidelines for YACC and LEX rmonroe@hever.demon.co.uk (Robert F. Monroe) (1996-02-02)
Re: WANTED: stylistic advice/guidelines for YACC and LEX Robert@hever.demon.co.uk (Robert F. Monroe) (1996-02-04)
Re: WANTED: stylistic advice/guidelines for YACC and LEX rmonroe@hever.demon.co.uk (Robert F. Monroe) (1996-02-09)
Re: WANTED: stylistic advice/guidelines for YACC and LEX ltribble@msmail4.hac.com (Tribble, Louis) (1996-02-09)
| List of all articles for this month |
From: Scott Stanchfield <scooter@mccabe.com>
Newsgroups: comp.compilers
Date: 29 Jan 1996 17:45:30 -0500
Organization: McCabe & Associates
References: 96-01-084
Keywords: yacc, lex, comment

Just for fun, here's my more useful style thing:


If you are writing a parser with several "types" in your %union
section, it can be difficult to remember which are which. If you
suffix each rule with its type, life becomes much easier.


For example,


%union
{
expr_type *pExpr;
char *szText;
var_type *pVar;
}


%type <pExpr> expr_pExpr
%type <pExpr> statement_pExpr
%type <szText> label_szText
%type <pVar> var_decl_pVar
%type <pVar> lvalue_pVar
[Urggh, a bit too Hungarian for my tastes. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.