Hello,
Last night I was cruisin’ around Wikipedia and was checking out various
programming languages. One in particular caught my eye — APL.
https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life
<https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life>
I thought it would be neat to have different type of syntax to express Gremlin
traversals and came up with the following "2D pipes” language.
https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c
<https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c>
Basically, there are “piping” symbols that dictate traverser flow:
- ^ / \
These pipes link the steps, where commonly used steps have a short-hand syntax.
The translator to go from this to Gremlin bytecode seems pretty simple. The
internal data structure for the language is:
List<List<String>>
This give you the 2D matrix. You then can go “up and down” the lists and “left
and right” along the tokens, where the - ^ \ / pipes tell you how to move about
the List<List<String>> structure.
Does anyone think this is cool?
Marko.
http://markorodriguez.com