lr parsing



	for precedence level 'p' values 20 to 1

		scan input text right to left, checking matches to patterns at precedence level 'p' for right-associative patterns

		replace each sequence of symbols matching a pattern with a single item, with pointers to sub-trees for the non-terminal symbols


		scan input text left to right, checking matches to patterns at precedence level 'p' for left-associative patterns

		replace each sequence of symbols matching a pattern with a single item, with pointers to sub-trees for the non-terminal symbols

	next


	e.g. 

	
		name = f(num) + num * num + num		after pass 1

		name = f(expr) + expr * expr + expr	after pass 2

		name = f(expr) + expr + expr		after pass 3

		name = expr + expr			after pass 4

		name = expr				after pass 5

		asgn					after pass 6

		stat					after pass 7



step 2 replaces 'expr * expr' with 'expr'



read program into a linked list of tokens

while not reduced to one symbol, sourcefile

	for precedence level 20 to 1

		scan right to left replacing sequences of symbols with the non-terminal symbol, 
			adding the replaced items into a parse tree, for right-associative rules

		scan left to right replacing sequences of symbols with the non-terminal symbol, 
			adding the replaced items into a parse tree, for left-associative rules
	next

end






if: 		if '(' expr ')' stat			prec: 1


statslist: 	'{' stat ';' statlist '}'	prec: 1		// incorrect fix later

		'{' stat '}'			


expr:	expr '+' expr		prec: 1  assoc: r
	expr '*' expr		prec: 2  assoc: r
	num			prec: 3  assoc: r
	'(' expr ')'		prec: 4  assoc: r





"{"  { stat | ';' } "}"		repeated stats, separator ';'	