3 ms·
> don't know of any other language that could be molded to accomplish the same feat. This kind of stuff is the bread and butter of Racket. For example Racket c
by dwohnitmok 5y ago
> don't know of any other language that could be molded to accomplish the same feat.
This kind of stuff is the bread and butter of Racket. For example Racket comes bundled with an implementation of Algol 60 that lets you write Algol in your Racket programs. https://docs.racket-lang.org/algol60/ https://docs.racket-lang.org/algol60/
There's two implementations of Javascript https://docs.racket-lang.org/ecmascript/index.html https://docs.racket-lang.org/ecmascript/index.html and https://docs.racket-lang.org/javascript/intro.html https://docs.racket-lang.org/javascript/intro.html, an implementation of Forth https://docs.racket-lang.org/forth/index.html https://docs.racket-lang.org/forth/index.html and a lot more.
- henryaj 5y agoIn e.g. the Algol example, it seems like you just get a function which can accept an Algol program as a string and run it. Seems quite different from what's been done in this case.
- gopiandcode 5y agoI think the process is exactly the same as the ruby example, except for the fact that while in ruby it was a hack, in racket, a programming-language programming language, is explicitly designed to allow for this kind of process. The linked website just mentions that the algol60 package also provides additional functions that allow executing over strings. The default mode of usage is to place a "#lang algol60" at the start of your files, and that configures the lexer/parser to allow the rest of the file to be parsed and interpreted as ALGOL code (just check out the examples in the packages's git forge page).
- dwohnitmok 5y agoYeah. Here's an example. It's exactly the same as any other Algol file except for the lang declaration at the top. https://github.com/racket/algol60/blob/master/examples/nqueen.a60 https://github.com/racket/algol60/blob/master/examples/nquee...