From: Dario Teixeira <dario.teixeira@nleyten.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Menhir grammar with sequences delimited by same token
Date: Sun, 08 May 2016 15:16:57 +0100 [thread overview]
Message-ID: <bfadd1210f535d40f2b2bbdb25928b2e@nleyten.com> (raw)
In-Reply-To: <20160508115742.GA14227@pema>
Hi,
> Jacques-Henri (or anybody else) please correct me if I am wrong.
>
> Sometimes one way of dealing with such problems is to recognize (at the
> syntactic stage) a
> language that is a bit bigger than the desired one and then to check,
> at
> the semantic level, that the real constraints are satisfied.
You make a good point, but in this case the reverse actually applies.
Trees such as "[Bold [Bold Text]]" are valid according to the AST,
and are in fact possible with other markups.
Such trees may be nonsensical in practice, but are also harmless,
and the "AST sanitiser" (a component that checks for semantic
errors in the AST) does not presently complain about them.
The longer revised grammar (the one with inline_sans_bold et al)
accepts only a *subset* of the valid ASTs, because it excludes
such improbable (but valid!) derivations. Therefore, this is
a case where the parser deliberately recognises a language that
is *smaller* than that accepted by the AST.
Best regards,
Dario Teixeira
next prev parent reply other threads:[~2016-05-08 14:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-08 9:33 Dario Teixeira
2016-05-08 10:27 ` Jacques-Henri Jourdan
2016-05-08 11:57 ` Sébastien Hinderer
2016-05-08 14:16 ` Dario Teixeira [this message]
2016-05-08 13:43 ` Dario Teixeira
2016-05-08 21:29 ` Jacques-Henri Jourdan
2016-05-08 13:35 ` Allan Wegan
2016-05-08 14:19 ` Dario Teixeira
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=bfadd1210f535d40f2b2bbdb25928b2e@nleyten.com \
--to=dario.teixeira@nleyten.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