The DejaVU Framework -- hush 3.0
[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?

parser: yacc.y hush-3.0b4/api/grammar/examples/terms


[.] - [up] [top] - index C++ text make include source grammar scripts
  

sp_yacc


  %class sp_yacc
  %token  ATOM VAR
  
  include <yacc.h>
  //#define YYDEBUG 1
  
  define sp_con(X)
  define sp_var(X)
  define sp_fun0(P)
  define sp_fun1(P,A1)
  define sp_fun2(P,A1,A2) cout << "fun/2: " << P << " " << A1 << " " << A2 << endl;
  
  %start goal
  
  goal: term { cerr << "goal: " << $1.v << endl; return $1.v; }
  
  atom: ATOM
  var: VAR
  
  fun: atom '(' ')'
     | atom '(' term ')' 
     { cout << "fun/1: " << $1 << " " << $3 << endl; }
     | atom '(' term ',' term ')'
     { sp_fun2(&$1,&$3,&$5) }
     | atom '(' term ',' term ',' term  ')'
  
  term: atom { cout << "atom: " << $1 << endl; }
      | var  { cout << "var: " << $1 << endl; }
      | fun
      ;
  
  compound: atom '(' arguments ')' 
  arguments: term
          | arguments ',' term
  

[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?
Hush Online Technology
hush@cs.vu.nl
09/09/98