[comp.sys.mips] MIPS YACC commedations and question

cliff@.UCalgary.CA (Cliff Marcellus) (11/26/89)

Hello Fellow MIPSers,

  Has anyone else out there had opportunity to write a compiler
  using the MIPS version of YACC(1)???  I for one, would just like to
  say "bravo!" to the person(s) at MIPS responsible for generating this
  version!  It performs better (ie. faster and has better error recovey)
  and has a wonderful debug mode (kicking out not only, "shift" and "reduce"
  conditions, but the productions in use also!)

  Well now the (not so) down side... does anyone know what a configuration
  in a state of the form :

  expression : expression PLUSOP $$56 error

  means?  (I don't know what "$$56" is supposed to do for me, and it's
  not in the documentation -- at least I can't find it.)

  Many Thanks!

Cliff
--
Cliff Marcellus                UUCP     : {any backbone}!calgary!ssg-vax-a!cliff
Dept of Physics and Astronomy  DOMAIN   : cliff@ssg-vax-a.phys.UCalgary.CA
The University of Calgary      SPAN     : CANCAL::CLIFF                 
OPINIONS WITHIN ARE MY OWN AND DO NOT REFLECT THOSE OF THE UNIVERSITY OF CALGARY

lai@mips.COM (David Lai) (11/30/89)

In article <2168@cs-spool.calgary.UUCP> cliff@.UCalgary.CA (Cliff Marcellus) writes:
>
>  Well now the (not so) down side... does anyone know what a configuration
>  in a state of the form :
>
>  expression : expression PLUSOP $$56 error
>
>  means?  (I don't know what "$$56" is supposed to do for me, and it's
>  not in the documentation -- at least I can't find it.)
>--
>Cliff Marcellus                UUCP     : {any backbone}!calgary!ssg-vax-a!cliff
>Dept of Physics and Astronomy  DOMAIN   : cliff@ssg-vax-a.phys.UCalgary.CA
>The University of Calgary      SPAN     : CANCAL::CLIFF                 

The $$56 is a generated reduction resulting from an action embedded in the
reduction rule, ie:

expression: expression PLUSOP { a=12; b=13; $$=100; } error
	{ $$ = $3; }
	;

would be translated to two reductions:

expression: expression PLUSOP $$1 error
	{ $$=$3; }
	;

$$1:
	{ a=12; b=13; $$=100; }
	;

The value of $$1 in the first rule's action ($3) is the value assigned
to $$ in the second rule's action.
-- 
        "What is a DJ if he can't scratch?"  - Uncle Jamms Army
     David Lai (lai@mips.com || {ames,prls,pyramid,decwrl}!mips!lai)