Parser
The turtlescript parser is written using the ANTLR v3 compiler generator available from www.antlr.org.
Currently there is a Javascript target and a Java target. The Java target is intended primarily to test the ANTLR gramamr. There are plenty of libraries that parse Turtle in languages such as Java and Python.
The Turtlescript parser currently generates a very simple Javascript format for evalutation purposes. This will mature and become better documented in future releases.
Add the following lines to your html:
]]>
Add the lib directory to your application. Copy it from the example.
See the example for more details.
Call the following code after the page is loaded (for example in a JQuery $(document).ready() function):
var n3 = getTurtleText();
$().log(n3);
var cstream = new org.antlr.runtime.ANTLRStringStream(n3);
var lexer = new N3Lexer(cstream);
var tstream = new org.antlr.runtime.CommonTokenStream(lexer);
var parser = new N3Parser(tstream);
parser.n3();
See example.js for more details.