Loading ...
Sorry, an error occurred while loading the content.
 

Need help for grammar of TL1 (a language used in North America in Telecom)

Expand Messages
  • ilkerpasa135
    I m new to antlr. And trying to learn antlr and prepare the grammar for TL1, a language used in North America for all Telecom equipment. Hence when I get it,
    Message 1 of 1 , Oct 2, 2003
      I'm new to antlr. And trying to learn antlr and prepare the grammar
      for TL1, a language used in North America for all Telecom equipment.
      Hence when I get it, it could be an interesting addition to antlr
      grammars.

      Of course since I'm a newbei, when I run the following grammar I get
      many nondeterminism warnings, basically all over the place.

      Past couple of days (not full time tough), I went through antlr
      tutorials, documents, etc , but obviously I haven't gotten it and
      need help. Hence any help is appreciated.

      Here is what the TL1 command structure is like;
      VERB-modifier1-modifier2 : TID:AID:CTAG: : NAME=VALUE,NAME=VALUE ;
      VERB-modifier1-modifier2 : TID:AID:CTAG: : VALUE,VALUE ;
      Following are some TL1 command examples;
      ENT-EQPT-OC3:TID1:1-1-#-#-3:ctag123::attrib1=123,attrib2=456;
      ENT-EQPT-OC1:TID1:1-1-#-#-3:ctag123::123,456;


      Here is the grammar that I have;

      class TL1Parser extends Parser;
      options { buildAST=true; }

      // first just get TL1command grammar working
      //tl1Message : tl1Command | tl1Acknow | tl1Response | tl1Auto;
      tl1Message : tl1Command;

      tl1Command : (command_code DOUBL^ staging_blocks (DOUBL^
      payload_blocks)?) SEMI!;

      command_code : VERB (DASH^ modifier1 (DASH^ modifier2)?)?;
      modifier1 : NAME;
      modifier2 : NAME;

      staging_blocks : TID DOUBL^ AID DOUBL^ CTAG (DOUBL^ general_block)?;
      // general_block could be improved
      general_block : NAME;

      payload_blocks : data_block_list (DOUBL^ data_block_list)*;
      data_block_list : data_block (COMMA^ data_block)*;
      data_block : data_block_positional | data_block_named;
      data_block_positional : VALUE (COMMA^ VALUE)*;
      data_block_named : (NAME EQUAL^ VALUE) (COMMA^ (NAME EQUAL^ VALUE))*;



      class TL1Lexer extends Lexer;

      AID : ('a'..'z'|'A'..'Z'|'0'..'9'|'.'|'-'|'_'|'/'|'#')+;
      CTAG : ('a'..'z'|'A'..'Z'|'0'..'9')+;
      NAME : ('a'..'z'|'A'..'Z'|'0'..'9')+;
      TID : ('a'..'z'|'A'..'Z'|'0'..'9'|'.'|'-'|'_'|'/')+;
      VALUE : ('a'..'z'|'A'..'Z'|'0'..'9')+;
      VERB : ('a'..'z'|'A'..'Z')+;

      COMMA : ',';
      DASH : '-';
      DOUBL : ':';
      EQUAL : '=';
      SEMI : ';';

      WS : (' ' | '\t'
      | '\r' '\n' { newline(); }
      | '\n' { newline(); }
      )
      { $setType(Token.SKIP); };
    Your message has been successfully submitted and would be delivered to recipients shortly.