From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=DNS_FROM_RFC_POST, HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 42BF7BBAF for ; Tue, 23 Jun 2009 22:10:33 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmwCAHbTQEpIDtyZimdsb2JhbACCIzGVVj8BAQEKCQwHEQWoQIEZkB8BAwIEhAYFgTQ X-IronPort-AV: E=Sophos;i="4.42,277,1243807200"; d="scan'208";a="28619399" Received: from fg-out-1718.google.com ([72.14.220.153]) by mail2-smtp-roc.national.inria.fr with ESMTP; 23 Jun 2009 22:10:32 +0200 Received: by fg-out-1718.google.com with SMTP id l26so243482fgb.20 for ; Tue, 23 Jun 2009 13:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=O+sTsvCemcdT2CI8z01jdrh75iSG3JSjF9UOkrUB+HQ=; b=QPTK1ks4cOV7T2nTCIiEzY2K1pphiQwjYtNTx8QA1Ovl7RFSj15lGx1q+lNUgpW58+ 9Rzl0xVOMNIFKhrAlYYubvOguI9o53tW2df/KyRkiTXpLTl6/WXaTKoICctq9intkhf/ GKM7Hc2yudj96MyREbja/JkE+igYB4iEpbdhA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=bKd09IZHeE+Q8BPeFSwLYWR/Bwit+vOA+Z/q2XGECrZATMbVnfwBfwxUAy3DG5tuNS xH4bMyNT+F5Qae2V8Go/t2w6VRLm6iJmMhM5mUlzI8lXmVYSUhVhMtWIEKJtQDnfwALl 4tYKYJ5p7cxi0VoJ2Vs0r0jIQJd+isE52fkVY= MIME-Version: 1.0 Received: by 10.239.146.3 with SMTP id u3mr39980hba.52.1245787832166; Tue, 23 Jun 2009 13:10:32 -0700 (PDT) Date: Tue, 23 Jun 2009 21:10:32 +0100 Message-ID: <8401c38a0906231310t727c3e84na237c67e0ec1031c@mail.gmail.com> Subject: multiple %start symbols in parser From: Ligia Nistor To: caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=001485f9a84e33a976046d099599 X-Spam: no; 0.00; parser:01 parser:01 ocaml:01 ocamlyacc:01 lexbuf:01 lexing:01 lexbuf:01 ocaml:01 ocamlyacc:01 lexing:01 token:01 token:01 W15:98 parsing:01 pair:01 --001485f9a84e33a976046d099599 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --001485f9a84e33a976046d099599 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 "mai= n2". I know how to use one start symbol, as here(taken form "calc.ml"):

=A0let _ =3D
=A0=A0=A0=A0=A0=A0=A0=A0=A0 try
=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 let in_channel =3D open_in "lines.txt" in

= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 let lexbuf =3D Lexing.from_channel in_cha= nnel in
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 while true do
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 let result =3D HorsParser.main HorsLexer.token = lexbuf in
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Hors.print_pair_list result;= =A0
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 done
=A0=A0=A0=A0=A0=A0=A0=A0= =A0 with HorsLexer.Eof ->
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 exit 0
but I don't know how to call the function "HorsParser.main2&q= uot;.
I want to parse a part of the file "lines.txt" using the= rule "main", and then, the other part of the file using "ma= in2". Is this possible?
=A0I tried to call "HorsParser.main2", but I got a "Parsing.= parse_error".

Thanks,
Ligia
--001485f9a84e33a976046d099599--