You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to programmatically edit MOOcode from within the MOO it is necessary to expose a representation of the AST.
I propose a new verb_ast(obj, vrb) builtin which returns a map of maps, each representing an AST node.
While it would be possible to render the AST maps back into MOOcode server-side, I also propose a set_verb_ast builtin which will work equivalently to set_verb_code, just with AST nodes.
Implementation
Similar to the existing unparse infrastructure we can add functions like unparse_stmt_ast which call down into subfunctions like unparse_scatter_ast and so on.
Would such a patch be accepted?
The text was updated successfully, but these errors were encountered:
If you are going to expose the Abstract Syntax Tree (AST) to code written in MOOlang, you are going to need to decide what representation the code will receive.
what do you mean by the datatype ‘map of maps’ ?
A natural representation form might be a list of lists, with the leaf nodes as strings how is this different ?
A different form might be as a WAIF, or even as a full MOO object.
If you think this is interesting enough to design, just start implementing it.
Waiting for another person’s pre-acceptance of the code is just a frustrating life strategy.
I have many bruises and never completely done projects to testify that boldly doing things works better.
On a related note, if you add an AST as a datatype, you might setup the preconditions to allow MOOlang to incorporate Lisp style macros, which would be, in my opinion, a fabulous next step in MOOlang programming.
Please think about how to support such in the design phase of this built-in.
In order to programmatically edit MOOcode from within the MOO it is necessary to expose a representation of the AST.
I propose a new verb_ast(obj, vrb) builtin which returns a map of maps, each representing an AST node.
While it would be possible to render the AST maps back into MOOcode server-side, I also propose a set_verb_ast builtin which will work equivalently to set_verb_code, just with AST nodes.
Implementation
Similar to the existing unparse infrastructure we can add functions like unparse_stmt_ast which call down into subfunctions like unparse_scatter_ast and so on.
Would such a patch be accepted?
The text was updated successfully, but these errors were encountered: