Open volodya-lombrozo opened 5 days ago
As I have already described in the Sematic Labels section, we might try to introduce some labels to ANTLR grammar:
grammar Arithmetic; prog: stat+ ; stat: expr NEWLINE | ID '=' expr NEWLINE #ID_VariableDeclaration | NEWLINE ; expr: expr ('*' | '/' ) expr | expr ('+' | '-' ) expr | INT | ID #ID_VariableUsage | '(' expr ')' ; ID : [a-zA-Z]+ ; INT : [0-9]+ ; NEWLINE: '\r'? '\n' ; WS : [ \t]+ -> skip ;
Pay attention to the #ID_VariableDeclaration and #ID_VariableUsage labels usage. Both of them are applied to ID lexer rule. We should try if it's possible to guide program generation by using such labels.
#ID_VariableDeclaration
#ID_VariableUsage
ID
As I have already described in the Sematic Labels section, we might try to introduce some labels to ANTLR grammar:
Pay attention to the
#ID_VariableDeclaration
and#ID_VariableUsage
labels usage. Both of them are applied toID
lexer rule. We should try if it's possible to guide program generation by using such labels.