From: Joel Reymont <joelr1@gmail.com>
To: caml-list@inria.fr
Subject: Catching a double semicolon
Date: Tue, 6 Mar 2007 00:55:27 +0000 [thread overview]
Message-ID: <DE94B414-F4BC-4D9D-B820-A905F34F1271@gmail.com> (raw)
Folks,
Any idea how to catch a double semicolon in the decs rule of this
grammar?
I wish there was a way to get debugging output when a
Parsing.Parser_error exception is triggered as I can't figure out
what rule the parser is chocking on when I try an expression with two
semicolons at the end.
I know it's chocking on a semicolon because when I insert a "catch
all" error clause into the sections rule the error location points to
it.
The rules below are working fine since my tests pass.
program: sections { $1 }
sections:
| section EOF { $1 }
| sections section EOF { $1 @ $2 }
| EOF { [] }
section:
| decs { List.rev $1 }
| statements { List.rev $1 }
decs:
| declarations SEMI { $1 :: [] }
| decs declarations SEMI { $2 :: $1 }
declarations:
| input_declarations { $1 }
| var_declarations { $1 }
| array_declarations { $1 }
input_declarations:
| INPUT COLON input_decs { InputDecs (List.rev $3) }
| INPUT COLON input_decs error { syntax_error "Missing semicolon" 4 }
| INPUT COLON error { syntax_error "Nothing after INPUT:" 3 }
| INPUT error { syntax_error "Missing ':' after INPUT" 2 }
Thanks, Joel
--
http://wagerlabs.com/
reply other threads:[~2007-03-06 0:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=DE94B414-F4BC-4D9D-B820-A905F34F1271@gmail.com \
--to=joelr1@gmail.com \
--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