Wednesday, 15 February 2012

java - How to modularize a JavaCC grammar file (.jj)? -



java - How to modularize a JavaCC grammar file (.jj)? -

i learning compiler construction , want implement javascript grammar using javacc.

(i have written own javascript codemodel allows programmatic construction of javascript code, want write javacc-based parser counterpart that.)

my question is, is there way modularize javacc grammar (.jj-file) several files?

i have experience javaparser learning java_1_5.jj grammar. however, 3000+ loc file bit hard comprehend.

i split grammar file several parts it's easier hande , understand. google searchen on "javacc modular", "javacc include", "javacc import" brought me cryptic results did not help much.

to specific, how move definition of identifier (lines 380-1081) file?

there no way built in javacc modularize .jj files. best thing utilize jjt, allows move actions out of grammar file. if don't want utilize jjt, next best thing may utilize builder pattern.

if want include facility, there many preprocessors can used.

java javascript javacc javaparser

No comments:

Post a Comment