Re: [racket-users] Re: Readers and Namespaces

2017-08-22 Thread William G Hatch
On Thu, Aug 17, 2017 at 10:11:12PM -0700, Alexis King wrote: Generally, my recommendation is to essentially define your language in two passes: a direct translation to s-expressions, followed by a phase of macroexpansion. The first phase is what your reader interacts with. Give the primitives

Re: [racket-users] Re: Readers and Namespaces

2017-08-18 Thread Shu-Hung You
If you are implementing a new language, this can be done by delegating the "=-to-let" work to the macro-expander and let the reader simply parenthesizing the input into s-expression form. In this approach, we don't need to worry about being hygienic in the reader since the actual work is done by

Re: [racket-users] Re: Readers and Namespaces

2017-08-18 Thread gfb
Assuming the setup where you make a module syntax object and call strip-context on it, you can add a scope to all the user's identifiers after that so they're not considered “above” any of the language's identifiers. Make a function to do the marking: (define marker (make-syntax-introducer

Re: [racket-users] Re: Readers and Namespaces

2017-08-17 Thread Sam Waxman
On Friday, August 18, 2017 at 1:11:16 AM UTC-4, Alexis King wrote: > > On Aug 17, 2017, at 21:52, Sam Waxman wrote: > > > > On a related note, I've read that read-syntax is supposed to return a > > syntax-object whose lexical context is stripped. Why is that? Doesn't > >

Re: [racket-users] Re: Readers and Namespaces

2017-08-17 Thread Alexis King
> On Aug 17, 2017, at 21:52, Sam Waxman wrote: > > On a related note, I've read that read-syntax is supposed to return a > syntax-object whose lexical context is stripped. Why is that? Doesn't > that make it impossible for the language to know the difference > between the

[racket-users] Re: Readers and Namespaces

2017-08-17 Thread Sam Waxman
On Friday, August 18, 2017 at 12:47:45 AM UTC-4, Sam Waxman wrote: > I've recently run into some ambiguous identifier errors while writing a > reader, and I'm not sure how to solve them. > > The situation is as follows: > > I've created a version of "let" in one file. I'd like my reader to call