def main():
	
	rules, tokens = get_rules(), get_tokens()
	lines, columns = [], [0, 0]
	for name, expands in rules.iteritems():
		columns[0] = max(columns[0], len(name))
		for i, expand in enumerate(expands):
			
			bits = list(expand)
			for idx, s in enumerate(expand):
				if s.upper() == s:
					bits[idx] = '``' + tokens[s] + '``'
			
			defn = ' '.join(bits)
			columns[1] = max(columns[1], len(defn))
			lines.append((name if not i else '', defn))
	
	separator = ''.join((
		'+',
		'-' * (columns[0] + 2),
		'+',
		'-' * (columns[1] + 2),
		'+',
	))
	fmt = '| %%-%is | %%-%is |' % tuple(columns)
	
	print '*' * len(TITLE)
	print TITLE
	print '*' * len(TITLE)
	print
	print INTRO
	print
	
	for i, ln in enumerate(lines):
		print separator
		print ln % fmt
	print separator
dataset/ETHPy150Open djc/runa/doc/grammar.py/main/swapped operands of `%`