Skip to content
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

Incorrect docs for parsing and unparsing #2

Open
schuster opened this issue Mar 4, 2016 · 3 comments
Open

Incorrect docs for parsing and unparsing #2

schuster opened this issue Mar 4, 2016 · 3 comments

Comments

@schuster
Copy link

schuster commented Mar 4, 2016

Section 2.3 claims that define-language produces a parser function parse-<language-name> and an unparser unparse-<language-name>, but I'm told that's not the case and to use with-output-language instead. This should be reflected in the docs.

@akeep
Copy link
Member

akeep commented Mar 4, 2016

We removed the automatic parser-, but you can still define one using define-parser:

(define-parser parse- )

I think of the auto generated parser and with-output-language as being for slightly different purposes.  I use parse when I’m reading in a full program.  I tend to use with-output-language when I’m ginning up bits of language form outside of the right-hand side of a pass body.

When I get some spare time, I will update the docs accordingly.

Since I’ve noticed you’ve commented more on this :)

Kent and I made the strategic decision to make the asymmetric change of having define-parser be separate while define-unparsed is not, because we were basically never using the parsers for the Chez Scheme compiler.  The parsers are too simple to really be useful inside a commercial compiler, but they are great for a teaching compiler.  The unparsers, on the other hand, and useful for tracing and for error messages and almost always end up getting used.  (In particular the trace-define-pass makes use of the unparsers, which is handy for debugging.)

That said, there is actually a separate define-unparsed form as well, and you can define separate unparsers with it, if you wanted a different name, or something along those lines.

-andy:)
On March 4, 2016 at 3:01:45 PM, Jonathan Schuster ([email protected]) wrote:

Section 2.3 claims that define-language produces a parser function parse- and an unparser unparse-, but I'm told that's not the case and to use with-output-language instead. This should be reflected in the docs.


Reply to this email directly or view it on GitHub.

@leafac
Copy link
Contributor

leafac commented Feb 14, 2017

I’m reading Nanopass’ documentation and I just tripped over the false claim that parse-language-name would be provided. Only unparse-language-name is provided, and parse-language-name has to be defined with define-parser.

In other words, the implementation behaves like @akeep described in the comment above, of course. But the documentation doesn’t reflect that.

@jbclements
Copy link
Contributor

I believe #21 fixes this. Should have referenced this issue in the Pull request, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants