New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ocamlyacc documentation + feature wish #8305
Comments
Comment author: administrator
It's not that simple. The parser needs to look at the lex_start_p And if you look closely, you'll notice that it needs the value of So the change you are proposing is not as trivial as you think, -- Damien |
Comment author: administrator ----- The following addresses had permanent fatal errors ----- ----- Transcript of session follows ----- Reporting-MTA: dns; concorde.inria.fr Final-Recipient: RFC822; skaller@ozemail.com.ai Return-Path: caml-bugs@pauillac.inria.fr
It's not that simple. The parser needs to look at the lex_start_p And if you look closely, you'll notice that it needs the value of So the change you are proposing is not as trivial as you think, -- Damien |
Comment author: administrator Calling conventions for ocamlyacc-generated parsers are documented in the |
Comment author: @damiendoligez Moreover, it is now recommended to use Menhir instead of ocamlyacc. |
Original bug ID: 1858
Reporter: administrator
Status: closed (set by @xavierleroy on 2013-08-31T10:46:13Z)
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: john skaller
Version: 3.07beta
OS: na
Submission from: proxy3.tpgi.com.au (203.26.24.213)
Ocamlyacc documentation omission:
The method of calling a generated parser is not documented. The only
clue to the calling convention is in the example of 12.6:
let _ =
try
let lexbuf = Lexing.from_channel stdin in
while true do
let result = Parser.main Lexer.token lexbuf in
print_int result; print_newline(); flush stdout
done
with Lexer.Eof ->
exit 0
Ocamlyacc feature wish:
The calling convention is sometimes inconvenient and not
properly generalised. Please at least add a new interface
parser_function (token_source: unit->Token.token)
which accepts a single function that is called to return tokens.
[This should be the principal interface, with the existing
interface just being a wrapper around it]
The current interface may sometimes be useful, but if the token
source is different than a lexer/lexbuf pair it is very inconvenient
to make a dummy lexbuf object (and lexer) just to satisfy the interface.
As it is the interface fails to correctly handle C,
in which #include files require a stack of lexbufs.
The existing interface also doesn't accomodate the ability to add arguments
to the lexer function. The lexbuf is just another argument: the parser
shouldn't know anything about lexbufs.
The text was updated successfully, but these errors were encountered: