[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [plt-scheme] Adding a language

>   - have this button get the current drscheme:language:language<%>
>     (this tells you how to compile the program in the definitions
>      window into Scheme) and use the front-end method to
>     get Scheme code out.

	I can't tell, but I think I'm going about this the (hard?) way. I've
wandered down the path of adding a language; I think this is very different
(but viable, I would assume) than what you suggested. I'm stuck in what the
front-end and on-evaluate methods of my lang% should do, though. I'd rather not
have to go the route of Algol60 (lex and parse my language, since my language
is Scheme--I'd like S-expressions, actually), but that seems (?) to be the
nature of implementing a new language the way I've wandered.

	I think there is more than one way to do this, though, and I've read
(but not fully understood) enough of the help and source in a few different
collections that I have more questions. I have the distinct feeling that either
A) I'm making this harder than necessary, B) there is a lot to absorb, and/or
C) perhaps it is kinda tricky.

	Under 103, I once did some crude things with a button, and it simply
grabbed the contents of the definitions window, and abused those. Going back to
the first email on this topic, that _seems_ to be what you suggested.

	1) Add a button
	2) Have the button use the front-end method of the current language<%>
to get the contents of the definitions window
	3) Abuse the contents (somehow get the contents into a list of
S-expressions, ideally, then invoke my compiler on the code)
	4) Send results off to external device/file/whatever

	Adding a language or adding a button that does the work both seem like
viable approaches; adding a button seems to be simpler (although I'm asking
about it because I want some more insight into this), but adding a language
would preclude adding a button, and instead (perhaps?) hitting "Execute" would
do the same thing as any "Compile to brick" button. This would allow
me/users/students to simply program into the definitions window and hit execute
as if it were a normal Scheme program.


	In short, I'm confused as to the relative merits of these two
approaches, if indeed they are two approaches.


	(Let me know if I should take this off list; I haven't seen anyone else
wade through implementing a language on-list, though, so it might be valuable
to have archived.)