Tuesday, September 25, 2012

Decl is dead. Long live Decl.

I just pulled the plug on the old Decl at Github, replacing it with a tabula rasa generated by module-starter.  The goal at hand is simple: rethink everything from the ground up.  So first things first - our first program to implement is this:
text "Hello, World!"
To make that work, we need a few things:
  • The interpreter environment itself (an object of type "Decl").  The environment was itself a node in the last iteration, and I suspect that's a mistake.  There should be a root node for ease of self-printing, but that should be a child of the environment, not the environment itself.
  • A "decl" command right from the start that acts like an interpreter.  The environment should be a shell, I think, so we can interact with the environment.  It's not a Python shell - the Python shell builds the environment as the result of a series of verbs, and that's specifically what Decl doesn't want to do.
  • Loading code into an environment has to be easier: (1) with a source filter, (2) passing a string in, (3) from a file, and (4) passing some intermediate data structure in - all those have to be supported more transparently than the last version.
  • The output handling system has to be in place in at least a rudimentary fashion here.
  • Marpa parser.  I'll probably need to refine the grammar as I go.
About that. In the old version, I had sigils to determine how the body of a node would be handled.  I'm eliminating that.  Instead, a trailing quote will mark a text body, and brackets a code body.  Anything else is vanilla nodes. Sigils are simply too hard to remember.

Similarly, the language a code body is in was marked with perl < { } or python < { }.  I doubt that's a good idea. It's clunky and ugly - and I want to be able to use Python with ease and elegance (as well as C).  I'm not yet sure what the solution is.  For multiline code bodies, I can see "{ (perl)" as an override of the default language - the default language being set sometime earlier.  For single-line code bodies, though, I don't see that as sufficiently elegant.

Another thing I've been thinking of.  When using a semantic domain module, I want a much, much more explicit definition of the tags in the domain.  To date this has really sucked.  If a module is used from within a Decl environment, then a lot more information should be provided right at the start.  If the same module is used from Perl, though, it should act like a Perl module - and load Decl itself.

This won't come up for a little while, of course - definition of domains is a little way down the rebooted road.

This might take a while.

No comments:

Post a Comment