SmaCCRefactoring / SmaCC

Smalltalk Compiler Compiler : a parser generator
Other
32 stars 15 forks source link

Is %root not capitalizing its parameter? #36

Open ThierryGoubier opened 7 years ago

ThierryGoubier commented 7 years ago

From the IDL parser:

%root specification;
%prefix AST;
%suffix Node;

specification 
    : definition 'definition' {{}}
    | specification 'specification' definition 'definition' {{}}
    ;

creates both an ASTspecificationNode and an ASTSpecificationNode, and associated visitor methods: ASTspecificationNodeVisitor>>#visitspecification: and ASTspecificationNodeVisitor>>#visitSpecification:.

apblack commented 7 years ago

Interesting issue! Related: if a user of SmaCC chooses to use lower-case names for their non-terminals, will the generated classes have lower-case names? Will this break Pharo?

ThierryGoubier commented 7 years ago

Well, as you noticed in that case, it capitalize non-terminals names before using them for AST node class names, making it safe for Pharo, except in the %root option... and I suspect the %prefix and %suffix options as well.