caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* multiple %start symbols in parser
@ 2009-06-23 20:10 Ligia Nistor
  2009-06-23 20:30 ` [Caml-list] " Will Leiserson
  2009-06-23 21:37 ` Jon Harrop
  0 siblings, 2 replies; 3+ messages in thread
From: Ligia Nistor @ 2009-06-23 20:10 UTC (permalink / raw)
  To: caml-list

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-23 20:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-23 20:10 multiple %start symbols in parser Ligia Nistor
2009-06-23 20:30 ` [Caml-list] " Will Leiserson
2009-06-23 21:37 ` Jon Harrop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).