richard_shelton
richard_shelton on Hacker News
https://github.com/true-grue/python-dsls/blob/main/datalog/d...
https://www.researchgate.net/profile/Peter-Sovietov/publicat...
Development a SMT solver-based code generator for specialized processors
Still, the idea of Fortik is to encourage students to learn how simple interpreters work and to extend the language.
Tiny stack-based language implementation (61 sloc, Python)
Tiny (51 sloc) SQL-like database query interpreter written in Python
[1] https://en.wikipedia.org/wiki/Asynchronous_array_of_simple_p...
Again, thank you very much for all your education reverse engineering works!
https://github.com/true-grue/terrain
Looks like Python+Tkinter is a good demoscene platform where you have performance of graphics close to 286/EGA :)
Tiny Python lib for using yEd as an alternative to Graphviz
And here is a toy term rewriting system [2].
[1] https://github.com/true-grue/raddsl
[2] https://github.com/true-grue/code-snippets/blob/master/ttrs....
It would be interesting to see how this rule ("x = (y + c1) + c2 => x = y + (с1 + с2)") was encoded in the compiler. I guess it has more complicated form than a (simple and declarative) term rewriting rule, which you may use on AST transform stage.
There is a quote from Muchnik's textbook: "Like constant folding, algebraic simplifications and reassociation are best structured in a compiler as a subroutine that can be called from any other phase that can make use of it".
But it seems that in some cases, on the later phases with lower IRs, you just can't use this "subroutine" as is.
Tools for rapid prototyping of DSL compilers (in Python)
As a side note. It would be interesting to investigate power of a Prolog-like language which has terms, term variables, pattern matching (maybe even without full unification) and only local backtracking. Plus an ability to make user-defined execution strategies (tree traversals etc) in the form of combinators. I already use most of these constucts in dsl_match module and I got my inspiration mostly from Stratego/XT. Still it would be good to see similiar general-purpose language and compare its expressiveness with Prolog.
1. BNF notation. Yes, it could be surprising, but in a BNF-like language we use function-level representation and white spaces here denote sequential composition of functions -- nonterminals.
2. In a some Lisp-like language one may use spaces to describe "abstract" composition. So, for sequential composition: "(seq func1 func2 func3)". And for parallel composition, for example: "(par func1 func2 func3)".
But in the case of real concatenative programming, which has its origin in Forth, you mostly deal with stacks and stack machines.
Still, the whole "concatenative" movement is interesting as a try to formalize the semantics and "improve" Forth language. See also Postscript and Henry Backer's articles [3].
Thanks for showing your code! I just placed my minimalist DSL tools and decided to use "Halt Problem" as an example. Here is my code: https://github.com/true-grue/dsl-tools
There is a good reason for using Prolog-like language in a compiler-related project. Prolog was used for rapid prototyping of compilers since the end of 70s and it's still ahead of the time. And if you take a look at a code from old Warren article [1], for example, you'll see that even today almost nobody uses so high-level description of a compiler. The main power of Prolog is not in parsing. Prolog is unbeatable in a program analysis and transformations. See Datalog (you may find it even in a Dragon book nowadays!), see Stratego/XT, they all inspired by good old Prolog.
By the way, Prolog is also good in describing formal semantics of PLs. Good PL reference or a standard should include clean formal notation for semanics of the language, not some bureaucratic English text... Because it's already 2018, we need it for compiler developers and for deeper understanding of a language.
[1] http://sovietov.com/tmp/warren1980.pdf (this is excellent article, but, sadly, almost unknown one)