
@elyandarin has joined the channel

Hi! Just got racket and started playing around with making a language, starting from the beautifulracket tutorial. Is there a recommended place to ask questions about problems I’m having with the lexer and tokenizer?

Here is fine. If no-one answers, try the mailing list.

But usually, you’ll get an answer here.

@elyandarin If you need to paste large amounts of code, then you can use http://pasterack.org/ which will syntax hightlight the code.

Yes, that was my original point - you can’t apply a macro such as for/list
:slightly_smiling_face:

That’s what I meant by, “I’m guessing that it’s not possible to use for/list
in this way, right?”

OK, so I want to handle parenthetical expressions somehow, but I’m not sure where to do it, or how. (I have very little experience with LISP-like languages, btw.) It makes sense to do it in the parser, but I’m not sure how to let parantheses through the tokenizer, and it seems awkward to convert to ’PAREN and ’END-PAREN tokens and do it that way, especially if I’m going to have to do that for square brackets and curly brackets as well. Is there a good example of how to do that, somewhere?

I have used ’OP and ’EP (for “open parenthesis” and “end parenthesis”) in the past.

OB EB for [ ] and OC EC for { }

Which lexer/parser are you using?

brag

and in the tokenizer, br/quicklang

I’m basically just trying to branch out from the tutorial at beautifulracket

I am not too familiar with br/quicklang, but the first example in brag docs is an example with nested expressions. https://docs.racket-lang.org/brag/

Huh, I’ll check that out, then. I was using the documentation on lexer.

Huh, turns out I can simply use a paren as a token and it works fine: ["(" (token ’()]

Hey @mflatt, the documentation for module->exports says the input module path needs to be either a module-path?
or a resolved-module-path?
, but the the following code seems to work:

(module->exports
(module-path-index-join
'racket/match #f))

Which seems to indicate that it also works with module-path-index?
. Is this intentional or a bug?

(Or to be more precise, can I rely on it.)

@elyandarin Better example: https://thenotepad.org/repos/rs2019/dir?ci=b94b3a7ec27b1a06&name=precalc

You can rely on it. I don’t know whether I accidentally upgraded it with the new expander or if the docs were wrong for longer, but I’ll fix the docs.

okay, thanks.

@mflatt In this code the x
seems to be in the values part of module->exports
, even though its defined with define-syntax
. Is this a bug?
(module foo racket
(provide x)
(define-syntax x 5))
(module bar racket
(require (for-syntax (submod ".." foo)))
(provide (for-syntax x)))
(require (submod "." bar))
(module->exports (quote-module-path bar))

If Ii move the for-syntax
es into foo
, it goes back into the syntax portion

It does look like a bug. I’ll have to investigate more.

@leif It’s a bug related to lazy instantiation of modules. I think I have a repair, but probably it’s best to test more and wait until morning to push it.

Makes sense. thanks.