Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Ocamlyacc questions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-02-06 (01:26)
From: Micha <micha-1@f...>
Subject: Re: [Caml-list] Ocamlyacc questions
Am Sonntag, 6. Februar 2005 03:24 schrieb
> 1. The action {} after the first identifier causes an error.  Does
> ocamlyacc not support actions before the last token? 

no, as far as I know, not

> How would I work 
> around this?

declare extra nonterminals such as:

program: PROGRAM prg_ident IDENTIFIER PERIOD {};

prg_ident: IDENTIFIER {} 

but you can get conflicts...

> 2. When the action from #1 is removed, I get an error message,
>     "no type has been declared for the start symbol"
>     but changing '%start program' to '%start <type> program' where type
>     is int, unit, etc. causes a syntax error.  Any ideas?

yes, it should be:

%start program
%type <type> program

the type is declared extra (as the docu says... :-)