Upgrade to Pro — share decks privately, control downloads, hide ads and more …

XQuery Development in Cloud9

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for William Candillon William Candillon
February 14, 2013
260

XQuery Development in Cloud9

XQuery is a double-edged sword: On one side, it enables building extremely powerful data-intensive applications. On the other side, the entry-barrier to the technology is extremely high. This puts a tremendous amount of pressure on the development tooling. Tools need to have a deep semantic knowledge of the language while still being widely accessible. Our goal is to contribute a new XQuery development toolkit that is entirely browser-based and heavily relies on static code analysis in order to provide a rich editing experience.

Avatar for William Candillon

William Candillon

February 14, 2013
Tweet

Transcript

  1. XQuery ::= Module EOF Module ::= ( LibraryModule | MainModule

    ) LibraryModule ::= ModuleDecl Prolog ... var h = new JSONParseTree(code); var parser = new XQueryParser(code, h); parser.parse_XQuery(); h.getParseTree();
  2. var code = "if(if) then then else else"; var sh

    = new SemanticHighlighter(code); var tokens = sh.getTokens(); console.log(tokens); [ { 'type': 'keyword', 'value': 'if' }, { 'type': 'operator', 'value': '(' }, { 'type': 'nametest', 'value': 'if' }, { 'type': 'operator', 'value': ')' }, ... ]
  3. var code = fs.readFileSync("functx.xq"); var compiler = new Compiler(); var

    sctx = compiler.compile(code); sctx.getFunctions() [ {name:"add-attributes", params: [..], ..}, {name:"add-months", params: [..], ..}, ... ]
  4. var code = "let $a := 1\nlet $b := ";

    var compiler = new Compiler(); var sctx = compiler.compile(code); var scope = findScope(sctx, 0, 22); scope.getVarDecls() [ {name:"a", kind:"LetBinding", pos: {..}}, ]
  5. var code = "let $a := 1\nreturn 1"; var compiler

    = new Compiler(); var sctx = compiler.compile(code); console.log(sctx.markers); [ { pos: { sl: 0, sc: 5, el: 0, ec: 6 }, type: 'warning', level: 'warning', message: '$a: unused variable.' } ]