4 ms·
could I get something like this with Racket[1]? why would I chose this over Racket? [1] https://news.ycombinator.com/item?id=19232068 https://news.ycombinator.
by DyslexicAtheist 8y ago
could I get something like this with Racket[1]? why would I chose this over Racket?
[1] https://news.ycombinator.com/item?id=19232068 https://news.ycombinator.com/item?id=19232068
- jimmy_ruska 8y agoFrom my understanding this library takes a grammar and generates a run time interpreter for that grammar. Antlr is much more similar as it takes in a grammar, and generates code you can hook into at any part of the grammar parsing. Racket on the other hand gives you the ability to hook into the new language, convert it to racket syntax and then compile it. As far as I know racket doesn't give you a simple parsing grammar, and you're targeting outputting racket code if you make a language. Though you could always take racket as your AST and target something like C or LLVM if you want it to live outside of racket. Racket is not necessarily unique in that aspect, it just focuses on making it easier with tooling. Scala, Kotlin, Elixir are examples of some of the most successful languages https://www.youtube.com/watch?v=du6qWa8lWZA https://www.youtube.com/watch?v=du6qWa8lWZA
- jarcane 8y agoRacket had parser generators available. See for instance ragg, or is fork, the brag parser used in the Beautiful Racket book: https://docs.racket-lang.org/brag/index.html https://docs.racket-lang.org/brag/index.html The technique used in the book is to use brag to describe the grammar and generate a parser/tokenizer to s-expressions, and then you can either interpret it compile them directly, or use the Racket macro system itself to expand them into Racket. And of course, Racket's macro system itself can do quite much without even a parser generator. The standard library even includes an example ALGOL 60 implementation done as Racket macros, and examples of C and Java can be found on the package server.
- optevo 8y agoIndeed. I don't want to sound flippant as obviously a lot of hard work has gone into this but I would have thought that a lisp and a parser should be able to achieve the same no? Some even come with Turing Complete type systems and prolog subsystems. http://www.shenlanguage.org/ http://www.shenlanguage.org/