Skip to content

jond3k/csdltools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#CsdlTools

Tools for working with DataSift's Csdl query language

##Csdl Parser

You can start parsing Csdl straight away. Just use the Csdl.parse method

val csdl = Csdl.parse("interaction.content contains \"cheese\"")

The object you'll get back is some form of CsdlBody. Using pattern matching you can decide what to do next.

csdl match {
  case And(l, r) =>
    println("The left hand side is: %s" format l)
    println("The right hand side is: %s" format r)
  case _ => // ..

The hierarchy of AST classes is:

CsdlNode
|- CsdlBody
| |- And
| |- Or
| |- Not
| |- CsdlTaggedBody
| |- Returns
| |- Rule
| |- Stream
|- Argument
| |- Operator
| |- Target
| |- Text
| |- TextList
|- Tag

The parser is implemented using Scala's built-in parser combinators and doesn't provide very good error-handling so isn't too good for use inside editors, etc. It can be pretty useful for automated analysis and optimzation of CSDL we already know is well-formed.

##Future Goals

Right now I'm interested in adding the following:

  • Conversion to other languages
  • Optimization
  • Pretty-printing
  • Versioning, to automatically upgrade statements to newer version of the language

About

Some tools for manipulating DataSift's CSDL language

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages