[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | cjohnson@w... |
| Subject: | Ocamlyacc questions |
I'm evaluating ocamlyacc for a compiler implementation, and I was
hoping to get help with two questions. Here is a very simple ocamlyacc
grammar file:
%{
(* A simple ocamlyacc file for demonstration. *)
%}
%token <unit> PROGRAM
%token <string> IDENTIFIER
%start program
%%
program : PROGRAM IDENTIFIER {} IDENTIFIER PERIOD {} ;
%%
This has two errors:
1. The action {} after the first identifier causes an error. Does
ocamlyacc not support actions before the last token? How would I work
around this?
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?
Thanks in advance!
--
Chris Johnson
cjohnson@wcug.wwu.edu
The man who sets out to carry a cat by its tail learns something that
will always be useful and which never will grow dim or doubtful.
-- Mark Twain