From: Ligia Nistor <ligia.nicoleta@gmail.com>
To: caml-list@yquem.inria.fr
Subject: multiple %start symbols in parser
Date: Tue, 23 Jun 2009 21:10:32 +0100 [thread overview]
Message-ID: <8401c38a0906231310t727c3e84na237c67e0ec1031c@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 906 bytes --]
Hi,
I am writing a small parser in ocaml, using ocamlyacc. I need to define 2
start symbols in my file parser.mly, but I don't know how to use them. The
name of the 2 start symbols are "main"and "main2". I know how to use one
start symbol, as here(taken form "calc.ml"):
let _ =
try
let in_channel = open_in "lines.txt" in
let lexbuf = Lexing.from_channel in_channel in
while true do
let result = HorsParser.main HorsLexer.token lexbuf in
Hors.print_pair_list result;
done
with HorsLexer.Eof ->
exit 0
but I don't know how to call the function "HorsParser.main2".
I want to parse a part of the file "lines.txt" using the rule "main", and
then, the other part of the file using "main2". Is this possible?
I tried to call "HorsParser.main2", but I got a "Parsing.parse_error".
Thanks,
Ligia
[-- Attachment #2: Type: text/html, Size: 1122 bytes --]
next reply other threads:[~2009-06-23 20:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 20:10 Ligia Nistor [this message]
2009-06-23 20:30 ` [Caml-list] " Will Leiserson
2009-06-23 21:37 ` Jon Harrop
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=8401c38a0906231310t727c3e84na237c67e0ec1031c@mail.gmail.com \
--to=ligia.nicoleta@gmail.com \
--cc=caml-list@yquem.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