Menu

[r15]: / trunk / python / python.lime  Maximize  Restore  History

Download this file

40 lines (25 with data), 617 Bytes

%class python
%start stmt

%left '+' '-'
%left '*' '/' 

stmt = simple_stmt 
	 | compound_stmt
	 .

simple_stmt = small_stmt NEWLINE simple_stmt 
			| small_stmt NEWLINE			
			.

small_stmt = cmd_stmt
		   | assign_stmt 
		   .

compound_stmt = for_stmt .

cmd_stmt = NAME DSTRING {python_command($1,$2);} .

assign_stmt = varlist EQUAL exprlist .

for_stmt = FOR exprlist IN testlist COLON { python_for(); } suite { python_end_for(); } .

suite = simple_stmt 
	  | NEWLINE INDENT stmt DEDENT
	  .

exprlist = NAME .

testlist = test .

test = expr .

expr = NAME RBO argslist RBC .

argslist = NUMBER COMMA NUMBER .
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.