netspooky/xx

Proposal of xx grammar (LL1)

redcrab2016 opened this issue · 0 comments

A proposal for the xx grammar(LL1) with repeater of data line

XX:
	  COMMENT XX
	| DATA REPEAT XX
	| SPACE XX
	| EOL XX
	| end of file

COMMENT:
	  ONELINECOMMENT
	| MULTILINECOMMENT

ONELINECOMMENT:
	  STARTONELINECOMENT ONELINE

MULTILINECOMMENT:
	 '/*' ANYCHARS

STARTONELINECOMMENT:
	'#' | '--' | '%' | ';' |  '//' | '|' | GRAPHCHARS

GRAPHCHARS:
	any character with ASCII(whatever code page) or UNICODE greater than 127

ONELINE:
	  LINECHAR ONELINE 
	| EOL
	| ε

LINECHAR:
	any character ASCII(whatever code page) or UNICODE except characters '\r' and '\n'

EOL:
	  '\r\n'
	| '\n'

ANYCHARS:
	  '*/'
	| ANYCHAR ANYCHARS 
	|  ε 

ANYCHAR:
	any ASCII or UNICODE character

REPEAT:
	  OPTIONALSPACES '*' OPTIONALSPACES FACTOR
	| ε

FACTOR:
	  LARGEHEXVALUE
	| DECIMAL

DATA:
	  SEPARATOR SINGLEDATA SEPARATOR DATA
	| ε

SINGLEDATA:
	  HEXVALUE
	| CHARSTRING
	| HEXBYTE

SEPARATOR:
	  SPACE SEPARATOR
	| ':' 
	| ',' 
	| ε

OPTIONALSPACES:
	  SPACE OPTIONALSPACES
	| ε

SPACE:
	  ' '
	| '\t'

DECIMAL:
	DIGIT OPTIONALDECIMALS

OPTIONALDECIMALS:
	  SINGLEDECIMAL OPTIONALDECIMALS
	| ε

SINGLEDECIMAL:
	'0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'

HEXVALUE:
	  '0x' HEXBYTE
	| '$' HEXBYTE
	| '\\x' HEXBYTE
	| HEXBYTE 'h'

LARGEHEXVALUE:
	  '0x' HEXBYTES
	| '$' HEXBYTES
	| '\\x' HEXBYTES
	| HEXBYTES 'h'
	

HEXBYTES:
	  HEXBYTE OPTIONALHEXBYTES

OPTIONALHEXBYTES:
	  HEXBYTE OPTIONALHEXBYTES
	| ε

HEXBYTE:
	  HEXACHAR HEXACHAR

HEXACHAR:
	'0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f'

CHARSTRING:
	  '"' ASCIISTRING '"'
	
ASCIISTRING:
	  ASCII7 ASCIISTRING
	| ASCII7

ASCII7:
	  '\\"'
	| Any single ASCII byte character between 32 and 127 inclusive