From: cjohnson@wcug.wwu.edu
To: caml-list@inria.fr
Subject: Ocamlyacc questions
Date: Sat, 5 Feb 2005 18:24:56 -0800 [thread overview]
Message-ID: <20050206022456.GA5170@wcug.wwu.edu> (raw)
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
next reply other threads:[~2005-02-06 1:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-06 2:24 cjohnson [this message]
2005-02-06 1:26 ` [Caml-list] " Micha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050206022456.GA5170@wcug.wwu.edu \
--to=cjohnson@wcug.wwu.edu \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox