Path: utzoo!attcan!uunet!wuarchive!uwm.edu!ux1.cso.uiuc.edu!tank!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: lex/yacc question Message-ID: <21074@mimsy.umd.edu> Date: 2 Dec 89 15:42:08 GMT References: <21582@adm.BRL.MIL> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 22 In article <21582@adm.BRL.MIL> thoth!jbd0@gte.com (Jeffrey B. DeLeo) writes: >Once you have identified your lexical primitives you should be all >set. These will be the nonterminals for your grammar; the grammar >being defined in the yacc source file. Since no one else has said anything yet, I will point out that these are the terminals. The nonterminals are the other words in the grammar: %token BAR BAZ FOO THE %% grammar: sentence | grammar sentence; sentence: FOO rest '.'; rest: /* empty */ | THE object; object: BAR | BAZ; %% Here there are 7 terminals (BAR, BAZ, FOO, and THE, and 3 unnamed: $end, $error [a yacc internal thing, not actually used here], and the period `.') and 4 nonterminals (grammar, sentence, rest, and object). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris