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

Reader is too liberal #34

Open
david-christiansen opened this issue Apr 22, 2019 · 0 comments
Open

Reader is too liberal #34

david-christiansen opened this issue Apr 22, 2019 · 0 comments

Comments

@david-christiansen
Copy link
Member

Our re-use of the Racket reader leads to this implementation accepting programs that the book implies should be rejected. Here are examples from an email that I received:

1. Pipe-Delimited Atoms

In the textbook, an Atom is supposedly an apostrophe followed by one or more letters or hyphens. However, in the current version of Pie you can also use pipes.
Example code:

(check-same Atom '|sam| 'sam)
(check-same Atom '|s||a||m| 'sam)
(check-same Atom '|||s|am 'sam)
(check-same Atom '|| '||||||)

2. Spaces in Atoms

I don't think this matters as much, but a space is not a letter or hyphen, so I might as well mention it. Also, this messes with the syntax highlighting.
Example code:

(check-same Atom '    abc 'abc)
(check-same Atom '      abc '  abc)

3. Number Oddities

I doubt anyone would ever stumble upon this unless they've already programmed in Racket. Also, I don't think any of these even need changing. Anyway, here's the example code:

(check-same Nat -0 0)
(check-same Nat 0/3 0)
(check-same Nat -0/3 0)
(check-same Nat 12/4 3)
(check-same Nat #e5 5)
(check-same Nat 2+0i 2)
(check-same Nat #x10 16)
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

1 participant