Hacker News new | ask | show | jobs
A simple Forth-like language intended for DSL creation, implemented in Lua (github.com)
34 points by IonoclastBrig 4072 days ago
3 comments

I wrote a pretty detailed blog article about the motivations and some design aspects of the project. If you want to play with a new little toy, I'd love any (constructive!) feedback, bug reports, pull requests, etc.

http://blog.ionoclast.com/2015/05/firth-pre-alpha-1-a-forth-...

Have you seen http://terralang.org ? With a little work, your DSL could be generating stand-alone, statically compiled executables and c-linkable libs :D
Oh, I hadn't heard of that. Sounds interesting... I've also considered at some point switching to an LLVM backend, which would let me JIT on the fly or build executables.
You just exactly described Terra :)

You run Lua to construct sequences of code in the language Terra. The Terra functions can be jitted or AOT compiled through LLVM.

Although I love old-school languages like Forth, Smalltalk, and LISP, I find it weird to use Forth for a DSL. I looked into the example and it's not very readable, to be honest.
Forth's entire raison d'ĂȘtre is to provide a simple basis for building DSLs, in some sense. The reason it works so well is that not only can you attach any compile-time and/or runtime semantics you want to any arbitrary input token, but you can override, extend, and manipulate the parser, compiler, and interpreter like any other provided service.

The syntax is terse and a bit difficult to parse if you're not familiar with forth, since I follow many of their naming conventions. This is mostly at the lowest levels of code, though; it is expected that you'll end up building your own convenience functions and syntax extensions along the way.

Stack based language is simple and cool. Although I did not use Forth, I once used qinmishu(http://qinmishu.org).
Translated from qinmishu.org: "Different Chinese and English, Chinese and English programming programming should be somewhat different fishes." Apparently google isn't very good at Chinese...