The LinF Grammar


grammar	: com_seq
		;

com_seq : com_seq pr_com
		|
		;

pr_com	: angles
		| lines
		| blanks
		| axiom
		| rules
		| colors
		;

colors	: COLORS c_seq
		;

c_seq	: c_seq c_desc
		| c_desc
		;

c_desc	: NUM ':' '(' NUM ',' NUM ',' NUM ')'
		;

angles	: ANGLES seq_ang
		;

seq_ang	: seq_ang ang
		| ang
		;

ang 	: ID ':' '(' angle ',' angle ')'
		| '(' angle ',' angle ')'
		;


angle	: '[' num_exp PP num_exp ']'
		| num_exp
		;

num_exp : num_exp '*' term
		| num_exp '/' term
		| term
		;

term	: term '+' factor
		| term '-' factor
		| factor
		;

factor	: '(' num_exp ')'
		| NUM
		;

lines	: LINES ln_sbs
		;

blanks : BLANKS bl_sbs
		;

ln_sbs	: ln_sbs ',' ID
		| ID
		;

bl_sbs	: bl_sbs ',' ID
		| ID
		;

axiom	: AXIOM exp_seq
		;

rules	: RULES r_seq
		;

r_seq	: r_seq ';' r_def
		| r_def
		;

r_def	: ID '=' exp_seq
		;

exp_seq : exp_seq exp
		|
		;

exp		: ID
		| '[' exp_seq ']'
		| '{' exp_seq '}'
		| '+'
		| '-'
		| '!'
		| '|'
		| num_exp '@'
		| num_exp '?' ID
		;