Classp: a “classier” way to parse
google-opensource.blogspot.com
google-opensource.blogspot.com
Not sure what they mean by "logical structure". But I've used Parsec to convert a string into AST. Then did a second pass with Parsec to turn that AST into VM representations of what the program is talking about. Which worked really well for me. :)
Disclaimer: of course I'm biased, I'd oppose anything with the word "class" in it.
Expr ::= Expr + Term | Expr - Term | Term;
Term ::= Term * Factor | Term / Factor | Factor
Factor ::= Int | ( Expr )For instance, there's probabilistic programming [1], where you write a procedural program that says "if we were to fix a bunch of properties/states of the natural world and provide them as input, here's the output/reading you'd hypothetically get," and then from that, a system creates a function that, given a large number of outputs/readings, provides a posterior probability distribution over those hidden properties/states of the world. It's still far from the level of performance you'd get from hand-rolled machine learning algorithms that take advantage of all sorts of insights you have into your data... but then again, in general programming, there was a time when compiler optimizations were so naive that you had to hand-roll assembly code for almost anything. I see probabilistic programming in a similar level of infancy, and I'm excited to see where it goes, especially with the backing of a large DARPA initiative [2] to do some really exciting fundamental research.
But there's so much more to the "invertible" paradigm. SQL itself is exactly along these lines - your WHERE clause is just a filter function that works on a single-record level, but it's interpreted as highly optimized instructions to iterate along data structures, to collect all the data that satisfies that filter function. Facebook's Relay [3] is the beginning, I think, of a large push towards declaratively specifying data dependencies for web applications, and having a system that does all the heavy lifting of figuring out when to fetch data, when to push it back to the server, how to handle requests on the server, and how to handle mutations with optimistic client-side updates. All you need to think about is the easy question of "what data might I need, and if it were to exist at any given moment, how would I display it to the end user?"
Humans think generatively, whether it's about data or formatting or GUIs or the physical world. We have all these ideas in our mind, and we can visualize how we would expect them to appear. When our computer systems can let us focus on those high-value thoughts, that's what the future looks like.
So let's cut the out-of-the-box parser thinkers some slack!
[1] http://www.pl-enthusiast.net/2014/09/08/probabilistic-progra...
[2] http://www.darpa.mil/our_work/i2o/programs/probabilistic_pro...