[
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: | Ligia Nistor <ligia.nicoleta@g...> |
| Subject: | multiple %start symbols in parser |
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