RSL grammer for ANTLR v3

by syoyo


I’ve finished writing grammer for RSL(RenderMan Shading Language) with ANTLR v3 parser generator.
It’s my first step and trial of ANTLR and LLVM based shader compiler & shader VM for lucille.

The grammer is checked by a few dozen of primitive shaders.

I’m been familiar with BNF style(bison/flex) to write grammer,
so I’ve little confused to write grammer with EBNF style.
Especially how to write operator priority in EBNF.
In EBNF(of ANTLR), this is done in recursively defining rules.

Anyway, overall, EBNF can write grammer more clean than BNF.
I’m falling in love to use ANTLR v3.

Next step is to writing syntax checker and walker for generated AST tree of RSL to convert AST to LLVM code.