Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 3a1862b76a6ee524e792d5696dca25fd > files > 33

epic4-2.10-2mdv2010.0.i586.rpm

This is a brief discussion on a new load parser.

The current load parser is kind of a hodge podge and a mess.  Plus, it's
pretty slow, and it has a few annoying limitations (such as the maximum
line length.)  I endevor to write a new load parser that fixes as many
of these problems as possible.

The new load parser will be a combination of a lexer and a parser, where
the lexer will remove tokens from the load parser, and the parser will
decide what to do with them.  Here are a sample of the possible tokens
you might find in a loaded file:

	#	The hash character (HASH)
	/*	The slash-star sequence (SLASH-STAR)
	*/	The star-slash sequence (STAR-SLASH)
	;	The semicolon character (SEMICOLON)
	\n	The newline character (NEWLINE)
	{	The opening brace (LBRACE)
	}	The closing brace (RBRACE)
	\	The backslash character (BACKSLASH)
	...	The literal string (STRING)

The lexer will submit each special token from the file one at a time to
the parser for consideration.  The parser will decide whether to accept
the token, or whether to reject it.  Rejected special tokens are accepted
as literal text strings.  The format of an input file looks roughly like
this:

	FILE		:= <LINE>*
	LINE		:= <C-COMMENT> | <HASH-COMMENT> | <COMMAND> | <EMPTY>
	C-COMMENT	:= <SLASH-STAR> <TEXT> <STAR-SLASH>
	HASH-COMMENT	:= <HASH> <STRING> <NEWLINE>
	COMMAND		:= <TEXT> <COMMAND-SEP>
	COMMAND-SEP     := <NEWLINE> !<BLOCK>
	BLOCK		:= <LBRACE> <COMMAND>* <RBRACE>
	EMPTY		:= <NEWLINE>

	TEXT		:= (<STRING>|<NEWLINE>)*
	STRING		:= (<NON-SPECIAL-CHAR>|<BACKSLASH> <ANY>)*

A "command" is some literal text, followed by some number of blocks.
The text may be seperated from the blocks by a newline and whitespace,
and blocks may be seperated from each other by a newline and whitespace.