[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Redefinition Error



Could someone glance through this and give me some clarity?
 
I've been hacking this together using the Java grammar as a "cookbook" of examples.
 
No matter what I put after "goal", I get a redefinition error.
 
In this case, I get a Redifinition of ADefines.
 
Any ideas?
 
Thanx!
Will Hartung
(willh@msoft.com)
 
------------------
 
Package rsl;
 
Helpers
 a = ['a' + 'A'];
 b = ['b' + 'B'];
 c = ['c' + 'C'];
 d = ['d' + 'D'];
 e = ['e' + 'E'];
 f = ['f' + 'F'];
 g = ['g' + 'G'];
 h = ['h' + 'H'];
 i = ['i' + 'I'];
 j = ['j' + 'J'];
 k = ['k' + 'K'];
 l = ['l' + 'L'];
 m = ['m' + 'M'];
 n = ['n' + 'N'];
 o = ['o' + 'O'];
 p = ['p' + 'P'];
 q = ['q' + 'Q'];
 r = ['r' + 'R'];
 s = ['s' + 'S'];
 t = ['t' + 'T'];
 u = ['u' + 'U'];
 v = ['v' + 'V'];
 w = ['w' + 'W'];
 x = ['x' + 'X'];
 y = ['y' + 'Y'];
 z = ['z' + 'Z'];
 letter = [['a' .. 'z'] + ['A' .. 'Z']];
 digit = ['0' .. '9'];
 id_letter = letter | '_' | '$';
 id_letter_or_digit = id_letter | digit;
 all_characters = [0 .. 255];
 cr = 13;
 lf = 10;
 ht = 9;
 ff = 14;
 sp = ' ';
 quote = '"';
 line_terminator = lf | cr | cr lf;
 white_space = cr | lf | ht | ff | sp;
 input_character = [all_characters - [cr + lf]];
 escape_sequence = '\b' | '\t' | '\n' | '\f' | '\"' | '\' ''' | '\\';
 string_character = [input_character - ['"' + '\']] | escape_sequence;
 string_literal = '"' string_character* '"';
 
Tokens
 defineevent = d e f i n e e v e n t;
 defineqbatch = d e f i n e q b a t c h;
 defineqset = d e f i n e q s e t;
 definestring = d e f i n e s t r i n g;
 definevar = d e f i n e v a r;
 
 blank = white_space*;
 
 semicolon = ';';
 dot = '.';
 comma = ',';
 
 assign = '=';
 int_literal = digit+;
 float_literal = digit+ '.' digit*;
 identifier = id_letter id_letter_or_digit*;
 
Ignored Tokens
 blank;
 
Productions
/*
 goal = rslscript;
 rslscript = defines*;
*/
 goal = defines*;
 

 defines =
  defineevent_stmt |
  definestring_stmt |
  defineqset_stmt |
  defineqbatch_stmt |
  definevar_stmt;
 
 number_literal = int_literal | float_literal;
 
 defineevent_stmt =
  defineevent identifier semicolon|
  defineevent command string_literal semicolon;
 
 id_list = identifier |
  id_list comma identifier;
 
 optional_list = comma id_list;
 
 events_clause = events id_list;
 
 defineqbatch_stmt =
  defineqbatch identifier comma
   string_literal comma
   id_list events_clause? semicolon;
 
 defineqset_stmt =
  defineqset identifier comma
   string_literal optional_list?
   events_clause? semicolon;
 
 optional_dot_id = dot string_literal;
 
 order_clause = comma int_literal;
 
 definestring_stmt =
  definestring identifier dot identifier optional_dot_id?
   assign string_literal order_clause? semicolon;
   
 definevar_stmt =
  definevar identifier dot identifier assign identifier
   int_literal? semicolon;