I found a partial thought on my hard drive, which was the idea of doing a PARSE-like thing in JavaScript, e.g.
if (parse("aaaabbbb", [Some, ["a", Or, "b"]])) {
...
}
let filename = parse("foo.txt", [Between, Here, ".txt"])
So the idea would be that things like Some and Or and Between and Here would look up to some kind of objects representing combinators. Arrays would be rules.
The lack of symbols would mean that you'd have to kind of import the combinators, setting Some = uparse.Some or SOME = uparse.Some or else you wind up with something like:
if (parse("aaaabbbb", [uparse.Some, ["a", uparse.Or, "b"]])) {
...
}
Core To The Gimmick: No Parentheses
I was a little torn in the prototype if JavaScript should use parentheses or not. You wouldn't want Or to use parentheses because that breaks the concept, but I wondered if combinators should have an arity:
if (parse("aaaabbbb", Some("a", Or, "b"))) {
...
}
let filename = parse("foo.txt", Between(Here, ".txt"))
But if rules aren't arrays, you've lost the advantage of "rules can be built and manipulated programmatically in a regular structure". And it starts devolving the idea to look like any other JavaScript parser combinator library.
So no... the rules should be arrays.
Calling Ren-C From WebAssembly Works Already
Note that today you can write:
if (rebDid("parse", data, "[some [--[a]-- | --[b]--]]")) {
...
}
let filename = rebUnbox("parse", input, "[between <here> --[.txt]--]")
And that uses the "in language" parse.
...So I Deleted The Scrap I Wrote
Many years ago when I scribbled this down there was no AI to ask to write such a thing. Now that there is, maybe it's interesting.
In the past Rebol influenced JavaScript via JSON. I don't know if a UPARSE simulation in JavaScript would catch anyone's attention at this point in history, but it might amuse us, at least.
Anyway, if anyone feels like working up what uparse.js could do and make a YouTube video about it, be my guest.