FAQ¶
- Which languages can CongoCC generate?
Java, Python, C#, and Rust, from the same grammar, selected with the
-langflag. Java is the default. See the Target Language Guide.- Do I need JJTree to build a syntax tree?
No. Tree building is part of CongoCC and on by default; there is no separate preprocessor. See Tree Building.
- How do I get the tree after parsing?
Call the start production, then
parser.rootNode(). Walk it with theNodeAPI or a visitor; see How To: Shape and Use the Tree.- Why didn’t a production produce a node?
Smart node creation (on by default) omits a node for a production that has only one child, to avoid trivial wrappers. Give the production an explicit
#Name, or turn offSMART_NODE_CREATION, to keep it. See Tree Building.- Do I have to catch the parse exception?
Not by default —
ParseExceptionis unchecked. SetUSE_CHECKED_EXCEPTIONif you want the compiler to enforce handling it. See Generated API.- How do I make the grammar case-insensitive?
Put
[IGNORE_CASE]on a single token production for a few keywords, or set the globalIGNORE_CASEfor the whole language. See Lexical Specification.- How are comments handled?
Declare them
UNPARSED(kept and attached to the next token, so tools can recover them) orSKIP(discarded). Block comments usually want a lazy token; see How To: Design Tokens.- Can a word be a keyword in some places and an identifier in others?
Yes — that is a “soft keyword”. Use token activation or a contextual token; see How To: Handle Context-Sensitive Input.
- What Java version do I need?
Java 17 or later to run CongoCC. See Installation.
- How do I move an old JavaCC grammar to CongoCC?
Convert its syntax, then build with CongoCC and apply a few fix-ups. See Migrating from JavaCC / JavaCC21.
- Is there an editor mode or syntax highlighting for ``.ccc`` files?
A grammar is plain UTF-8 text, so any editor works; there is no dedicated plugin required. The bundled
examples/grammars are good references to open alongside your own.