Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added README

  • Loading branch information...
commit 6d34176028617164f541260271dca84c0d1b5f28 1 parent 9cfc7f4
thoefer2 thoefer2 authored

Showing 1 changed file with 67 additions and 0 deletions. Show diff stats Hide diff stats

  1. +67 0 README.md
67 README.md
Source Rendered
... ... @@ -0,0 +1,67 @@
  1 +TURTLE
  2 +======
  3 +
  4 +This is a JavaScript based editor for the RDF serialization language
  5 +[Turtle](http://www.w3.org/TR/2012/WD-turtle-20120710/). I tested the
  6 +editor only in Google Chrome. The editor uses ANTLR´s JavaScript
  7 +backend to recognize input.
  8 +
  9 +
  10 +Features
  11 +--------
  12 +* Browser based editing support (with contentEditable) with respect to syntax highlighting.
  13 +* Syntax highlighting with respect to syntax-/lexer-errors.
  14 +* Resynchronization after syntax-/lexer-errors.
  15 +* Code completion.
  16 +
  17 +Semantic reasoning is currently not implemented.
  18 +
  19 +
  20 +Implementation overview for syntax highlighting and code completion
  21 +--------------------------------------------------------------------
  22 +From the user input it generates a parse tree (not an AST!) and traverses that as part of a classic
  23 +visitor strategy (Turtle.g). After that the generated code is being integrated in
  24 +the editor. Editor integration involves two things: Replacing
  25 +a fragment of turtle-code with generated code for the exact same (but
  26 +syntaxhighlighted) code fragment but also preserving incorrect code for
  27 +which there no representing node in the parse tree.
  28 +
  29 +If the cursor position is at a position that refers to a prefix
  30 +definition for a vocabulary it tries to show all components of that
  31 +vocabulary e.g. all definitions from FOAF. In order to display a
  32 +vocabulary in the appropriate way it´s a prerequisite to recognize and
  33 +translate a vocabulary (now with an AST!) to a JavaScript datastructure (ASTBuildingTurtle.g and ASTWalker.g).
  34 +This datastructure serves as the basis for syntax-highlighting. In this
  35 +respect there are two things of note:
  36 +
  37 +* A vocabulary can be deployed on any domain which is inherently
  38 + incompatible with the [Same Origin
  39 +Policy](http://en.wikipedia.org/wiki/Same_origin_policy). Code completion uses a
  40 +local webserver to work around that restriction. The webserver component
  41 +uses Sinatra and acts lika a proxy to the actual vocabulary resource.
  42 +A nice replacement for this would use [CORS](http://www.w3.org/TR/cors/) to perform a lookup.
  43 +CORS doesn´t need a local webserver.
  44 +
  45 +* Indeed that ajax request itself is asynchronous but the callback
  46 + handler needs to instantiate a new parser instance to perform the
  47 +translation. To prevent a user from typical blocking effects I
  48 +decided to implement that component with a
  49 +[WebWorker](http://www.w3.org/TR/workers/).
  50 +
  51 +
  52 +Starting the local webserver
  53 +----------------------------
  54 +If you want to use code completion you´ve to start a local webserver
  55 +which uses Ruby 1.9 with Sinatra. If these dependencies are available
  56 +just type "make s" to start the webserver.
  57 +
  58 +If you don´t start the webserver you can still rely on syntax
  59 +highlighting in the editor.
  60 +
  61 +
  62 +Screenshot
  63 +----------
  64 +(https://raw.github.com/thoefer/leonardo/master/screenshot.png "")
  65 +
  66 +
  67 +

0 comments on commit 6d34176

Please sign in to comment.
Something went wrong with that request. Please try again.