Hello. I am new to ANTLR. Below is a grammar I wrote, and I'm trying to
test it with the following string, but it just stops before it even
consumes the n_pp... identifier, so it stops at the "conjunction"
rule. Any idea about what I could be doing wrong?
<teststring below>
s_n2 := n_pp_c-pl-crd_le & [ STEM < "100s" >, SYNSEM [ LKEYS [
--COMPKEY _of_p_sel_rel,KEYREL.CARG "100" ], PHON.ONSET con ] ].
grammar tdl;
options
{
language=Java;
backtrack=true;
}
type_def
: type avm_def '.'
;
avm_def
: ':=' conjunction
;
conjunction
: term
| (term '&' conjunction)
;
term
: type
| STRING
| feature_term
| correference
| list
| diff_list
;
type
: ID
;
feature_term
: '[' ']'
| ('[' attr_val_list ']')
;
attr_val_list
: attr_val | (attr_val ',' attr_val)
;
attr_list
: attribute
| (attribute'.'attr_val_list)
;
attr_val
: attr_list conjunction
;
attribute
: ID
;
correference
: '#' ID
;
diff_list
: '<!' '!>'
| ('<!' conjunction_list '!>')
;
conjunction_list
: conjunction
| (conjunction ',' conjunction_list)
;
list
: '<' '>' | ('<' conjunction_list '>')
| ('<' conjunction_list '>' ',' '...')
| ('<' conjunction_list '.' conjunction '>')
;
lex_entry
: lex_id avm_def
;
lex_id
: ID
;
rule_entry
: rule_id avm_def
;
rule_id
: ID
;
ID : ('a'..'z'|'A'..'Z'|'_'|'-') ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-')*
;
COMMENT
: '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
| ';' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
| '/*' ( options {greedy=false;} : . )* '*/' {$channel=HIDDEN;}
| '#|' ( options {greedy=false;} : . )* '|#' {$channel=HIDDEN;}
;
STRING
: '"' ( ESC_SEQ | ~('\\'|'"') )* '"' |
'`' ( ESC_SEQ | ~('\\'|'"') )*
;
fragment
HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;
fragment
ESC_SEQ
: '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
| UNICODE_ESC
| OCTAL_ESC
;
fragment
UNICODE_ESC
: '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
;
fragment
OCTAL_ESC
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
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.