Re:A no-go fantasy: writing Go in Ruby with Ruby Next
by henryaj on Wednesday November 10, 2021 @04:57AM
(#29172956)
In 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.
Re:A no-go fantasy: writing Go in Ruby with Ruby Next
by gopiandcode on Wednesday November 10, 2021 @07:31AM
(#29173933)
I 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).
Re:A no-go fantasy: writing Go in Ruby with Ruby Next
by dwohnitmok on Wednesday November 10, 2021 @11:37AM
(#29176696)
Yeah. 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/nquee...
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/
There's two implementations of Javascript https://docs.racket-lang.org/ecmascript/index.html and https://docs.racket-lang.org/javascript/intro.html, an implementation of Forth https://docs.racket-lang.org/forth/index.html and a lot more.