Wednesday, May 16, 2012

Resurrecting "Object Curry" - Part 1: SQL/NF and Datalog

In my college days I was working on a language called Object Curry. (Around 1996-1998).
As I was cleaning my stuff yesterday,  I came across treasure trove of large numbers of my handwritten notes from college days. That's where I found "specs" for my language "Object Curry ™".


Many of the ideas are still applicable and I have decided to write a compiler and updated spec for the language. I plan to use parsing strategy from natural languages called Generalized Phrase Structure Grammar.
If the output is sensible enough I'll take it further.


What's in the name ?
The name is derived from my attempt to mix object oriented programming with sql/nf like querying.
That sounded like a tasty Indian Curry. On top of it can claim connection to currying in functional programming.


Renovation of syntax
I actually found two syntax for the language on Pascal like and other C like.  But over the years I have kind of merged it look like below.
The syntax remains pascal inspired but with more curly braces than before.


class Foo
{
    public x : int;
    private y : char; //note reverse order and pascal like colon
    protected arr : int { 1, 2 ,3};
    public Fn(param:string): int 
    { ... }


}


SQL/NF
SQL NF is form of nested relational calculus first published in 1985 , it has nested tables and two new operators nest and unnest.
Here are some of the original hand written notes. These ideas are still valid and used in new version of Object Curry. 

  • Original Object Curry was an attempt to solve impedance  mismatch between querying collections using declarative syntax and still being able to use in memory data structures. (see this note or this one
  • The enum keyword from C++ is repurposed to create some amazing syntax possibilities including piping and sequence generation. Mixing C++ pointers, streaming and iterators there was some good facility for cursor management.
  • The dynamic queries were also a possibility.
I will blog about the new syntax and semantics very soon.


How is this different than LINQ?

  • "Discovered" or rather stumbled upon by me before C# and Linq.
  • Uses SQL/NF as its basis and does not have group by.
  • Not Library based but syntax based. Compiler knows a lot more about the underlying collections.
  • "Query plan" so to speak is decided at compile time.  
Integration with Datalog and Prolog.
I was very fascinated by possibility of Object Curry having some capabilities like Datalog and better integration with Prolog.
Here are some initial thoughts from my college days  

Am I being nostalgic or this has some practical applications?
I think the concepts and syntax elements in the Object Curry are still valid in the era of NoSQL, json, GPGPU and map reduce. Hopefully I am able to come up with a practically useful implementation. 






No comments:

Post a Comment