You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 420 Reporter: administrator Status: closed (set by @damiendoligez on 2005-12-15T14:49:26Z) Resolution: won't fix Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general) Related to:#2327
I have had certain problems using/understanding ocamlyacc, which I
now believe have to do with an inconsistency in whether a parsed
expression needs to be followed by EOF or not.
I noticed a similar bug report (id 4) by Prof. Courant, which,
although from December 1999, is still open.
I did some further investigations, which I hope may be of help in
correcting the bug.
The problem seems to occur when the parser is able to reduce an
expression to the goal %entry% without considering the lookahead.
This reduction causes a semantic action raising the YYexit exception,
and thus finishing parsing.
This is a slight difference from what the *.output file would imply,
which is that one should then pass to the final state, containing the
action
$end accept
I suspect that it is the lack of this final test for $end=EOF that is
the cause of the bug.
I have tried to think of a fix, but I have not been able to understand
the C code. My best guess would be to modify the automaton so that
the final state exists and tests for $end.
Otherwise, I would like to add my voice to those who would like
ocamlyacc to allow the passing of an extra argument to semantic
actions.
Yours sincerely,
Ørjan Johansen.
The text was updated successfully, but these errors were encountered:
I have had certain problems using/understanding ocamlyacc, which I
now believe have to do with an inconsistency in whether a parsed
expression needs to be followed by EOF or not.
I noticed a similar bug report (id 4) by Prof. Courant, which,
although from December 1999, is still open.
Yes -- I'm still puzzled about this aspect of ocamlyacc!
Empirically, the following solution works well:
always have the grammar entry point of the form
entry: somestuff EOF {...} ;
always have the lexer emit the EOF token when hitting the end of the
input
This EOF token prevents the parser from "going too far". Still, I
agree that a better understanding of the $end pseudo-token could help.
Otherwise, I would like to add my voice to those who would like
ocamlyacc to allow the passing of an extra argument to semantic
actions.
You can sort of do it with having semantic actions return a functional
value. Built-in support for this would be nice, but it's not entirely
obvious.
Original bug ID: 420
Reporter: administrator
Status: closed (set by @damiendoligez on 2005-12-15T14:49:26Z)
Resolution: won't fix
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Related to: #2327
Bug description
Full_Name: Ørjan Johansen
Version: ocaml-3.01-2
OS: linux
Submission from: fimfpc67.math.ntnu.no (129.241.15.112)
Dear Caml developers,
I have had certain problems using/understanding ocamlyacc, which I
now believe have to do with an inconsistency in whether a parsed
expression needs to be followed by EOF or not.
I noticed a similar bug report (id 4) by Prof. Courant, which,
although from December 1999, is still open.
I did some further investigations, which I hope may be of help in
correcting the bug.
The problem seems to occur when the parser is able to reduce an
expression to the goal %entry% without considering the lookahead.
This reduction causes a semantic action raising the YYexit exception,
and thus finishing parsing.
This is a slight difference from what the *.output file would imply,
which is that one should then pass to the final state, containing the
action
$end accept
I suspect that it is the lack of this final test for $end=EOF that is
the cause of the bug.
I have tried to think of a fix, but I have not been able to understand
the C code. My best guess would be to modify the automaton so that
the final state exists and tests for $end.
Otherwise, I would like to add my voice to those who would like
ocamlyacc to allow the passing of an extra argument to semantic
actions.
Yours sincerely,
Ørjan Johansen.
The text was updated successfully, but these errors were encountered: