elyandarin
2019-11-5 12:25:47

@elyandarin has joined the channel


elyandarin
2019-11-5 12:30:13

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?


soegaard2
2019-11-5 12:30:55

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


soegaard2
2019-11-5 12:31:08

But usually, you’ll get an answer here.


soegaard2
2019-11-5 12:43:42

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


badkins
2019-11-5 13:54:53

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


badkins
2019-11-5 13:55:17

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


elyandarin
2019-11-5 14:31:21

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?


soegaard2
2019-11-5 14:33:09

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


soegaard2
2019-11-5 14:33:46

OB EB for [ ] and OC EC for { }


soegaard2
2019-11-5 14:34:00

Which lexer/parser are you using?


elyandarin
2019-11-5 14:34:29

brag


elyandarin
2019-11-5 14:35:23

and in the tokenizer, br/quicklang


elyandarin
2019-11-5 14:36:12

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


soegaard2
2019-11-5 14:37:50

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/


elyandarin
2019-11-5 14:39:15

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


elyandarin
2019-11-5 15:04:51

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


leif
2019-11-5 22:30:53

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:


leif
2019-11-5 22:30:58
(module->exports
 (module-path-index-join
  'racket/match #f))

leif
2019-11-5 22:31:26

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


leif
2019-11-5 22:31:34

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


soegaard2
2019-11-5 23:29:06

mflatt
2019-11-5 23:38:24

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.


leif
2019-11-6 01:33:25

okay, thanks.


leif
2019-11-6 01:40:34

@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))

leif
2019-11-6 01:41:23

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


mflatt
2019-11-6 01:42:55

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


mflatt
2019-11-6 02:34:35

@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.


leif
2019-11-6 03:05:03

Makes sense. thanks.