3 ms·
thanks for the interest, the implementation has been in stealth mode but an old first draft description of the language is at https://lookalive.software/ https:
by jazzyjackson 5y ago
thanks for the interest, the implementation has been in stealth mode but an old first draft description of the language is at https://lookalive.software/ https://lookalive.software/
Could you say what it means to 'project a sequence of state transitions' ? I am not hip to the CS lingo - you could say I am scanning the AST for tasks whose prerequisites include no further tasks, and replacing the branch of a completed task with its result.
Essentially all I'm doing is asking the coder to write an AST directly, except expressions can be mixed in with literals. I was just doing a kind of handlebars/mustache templating engine with JSON before realizing I had all the pieces for a general purpose language. My hello world(s) looks like:
{"body": [
{"#!cat planets.txt": [
{"h1": "#!echo hello :0"}
}]
]}
The interpreter scans the JSON for the #! token and checks if all the parameters are literals, so first it hits #!cat and sees the argument 'planets.txt', OK, nothing further to compute, pass it off to a subshell and get the result, say, `mercury\nvenus\nearth\mars`. Newline separated results get interpreted as an array, and arrays are mapped over the next branch of the tree to get:
{"body": [
{"#= mercury": [
{"h1": "#!echo hello :0"}
]},
{"#= venus": [
{"h1": "#!echo hello :0"}
]},
{"#= earth": [
{"h1": "#!echo hello :0"}
]},
{"#= mars": [
{"h1": "#!echo hello :0"}
]},
]}
At this point, there are four branches of the AST that have no shared dependencies, so my interpreter can solve them in parallel: before `#!echo` is ready, the colon marks a named (in this case numbered) argument to lookup so "#!echo hello :0" gets replaced with "#!echo hello mercury", and now all four echo branches can be forked in parallel. (If you're asking why I have to use a subshell and the echo program just to concatenate two strings, it's because the language has no builtins except #=, #&, #!, and #? ((for label, lookup, solve, and switch)). You can define functions but I wanted to start off with builtins provided by the OS, communications overhead be damned.) The '#=' then collapses once it's children are all literal so the final state of the program is:
{"body": [
{"h1":"hello mercury"},
{"h1":"hello venus"},
{"h1":"hello earth"},
{"h1":"hello mars"}
]}
Which can then be translated to HTML by `github.com/lookalive-software/elementary` -- besides the parallelism and declarative/functional style, my selling point is being able to step through the process, so the editor is able to rewind the state, adjust something, and resume execution. Every state is a new valid program (valid JSON too), so if you want to pause the program, upload it to a bigger computer, and resume you can do that to.
Not sure if those were quite the thoughts you were looking for, but I've been meaning to start writing docs for the current implementation anyway, so thanks for the push. If you want to know more details about the queueing / scheduler, I need to write the docs for that too ;)