[occi-wg] OCCI ANTLR Grammar

Edmonds, AndrewX andrewx.edmonds at intel.com
Tue Mar 22 11:57:10 CDT 2011


(In follow up to my previous mail).

I've placed my OCCI ANTLR grammar up on github [1]. There is some brief
documentation (presentation here [4]		) and examples on how to get
working with the grammar. There are 2 grammars. The first is just the
generic grammar with no target language ANTLR actions [2]. The second is the
same grammar but with Java-specific target language ANTLR actions [3]. Those
actions extract the values the parser encounters and assembles a data
structure that can then be queried. This all happens after validation of the
text request/response received. 

The grammar's lexer and parser can be used both in client and service code. 

For clients, the lexer/parser can be used to read the response from an OCCI
server and also validate outbound requests to a service.

For services, the lexer/parser can be used to validate the requests from
clients, extract values (if using a target specific grammar) and then
validate the responses sent back to the clients.

Of course, the grammar's lexer/parser is ideal for use in your test suites
especially for testing the serialization of your OCCI model to text. You
shouldn't worry about deserialisation as that should be the job of the ANTLR
grammar - with the relevant ANTLR actions.

The grammar and associated code is released under the BSD license so please
feel free to fork and use it. I know myself from experience that writing
parsers is a PITA and why repeat (DRY!) when you can leverage not just our
experience of specifying OCCI but also that of the ANTLR community in
creating parser generators! Win!

If anyone would like a walkthrough of this stuff, I can do so again at next
week's OCCI confcall as I won't be able to participate at Taipei.

Andy

[1] http://github.com/dizz/occi-grammar
[2] http://github.com/dizz/occi-grammar/tree/master/occi-antlr-grammar
[3] http://github.com/dizz/occi-grammar/tree/master/occi-antlr-java
[4] http://dl.dropbox.com/u/165239/OCCI-ANTLR.ppt


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5213 bytes
Desc: not available
Url : http://www.ogf.org/pipermail/occi-wg/attachments/20110322/0433a52f/attachment.bin 
-------------- next part --------------
-------------------------------------------------------------
Intel Ireland Limited (Branch)
Collinstown Industrial Park, Leixlip, County Kildare, Ireland
Registered Number: E902934

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the occi-wg mailing list