ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
visitor.cpp: In member function ‘virtual std::any kaic::Visitor::visitVariableDeclaration(kaic::KaiParser::VariableDeclarationContext*)’:
visitor.cpp:65:46: error: ‘struct kaic::Visitor’ has no member named ‘visitExpression’; did you mean ‘visitCallExpression’?
65 | auto value = std::any_cast<Value*>(this->visitExpression(ctx->expression()));
| ^~~~~~~~~~~~~~~
| visitCallExpression
visitor.cpp: In member function ‘virtual std::any kaic::Visitor::visitVariableAssignment(kaic::KaiParser::VariableAssignmentContext*)’:
visitor.cpp:89:47: error: ‘struct kaic::Visitor’ has no member named ‘visitExpression’; did you mean ‘visitCallExpression’?
89 | auto value = std::any_cast<Value *>(this->visitExpression(ctx->expression()));
| ^~~~~~~~~~~~~~~
| visitCallExpression
why is this happening? why can't I visit the expression? Also, when I checked the generated parser files, it seems like the expression context class doesn't have any methods that would point to callExpression and others
I'm trying to generate C++ code from this grammar (I don't know where the issue is exactly, so I'll paste the entire thing, since it's not too big):
I'm getting this compiler error:
why is this happening? why can't I visit the expression? Also, when I checked the generated parser files, it seems like the expression context class doesn't have any methods that would point to callExpression and others
Here's the variable declaration context class
Here's the expression context class:
I don't get it. How am I supposed to get to callExpression, identifierExpression or integerExpression??