Hi All ,
I'm working on an MSP430 assembly parser and I have this problem:
Fist of all this is a possible input for my grammar:
###################
# Theese are comments #
# #
# bla bla bla #
###################
labelA:
MOV.W #0x1234, R5
As you an see '#' is used either for an introductory log and also to
express a literal hex integer.
I'm trying something like (without success):
HEX_LITERAL : '0x' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ;
fragment HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;
COMMENT
: '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
| '#' '0x' => HEX_LITERAL
| '/*' ( options {greedy=false;} : . )* '*/' {$channel=HIDDEN;}
;
Result: [20:06:35] error(100): msp430.g:111:11: syntax error: antlr:
msp430.g:111:11: unexpected token: '0x'
Could you please help me? How can I capture literal integer within this
grammar?
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.