コード例 #1
0
ファイル: parse.cpp プロジェクト: lvchmi/simpleCompilier
TreeNode * for_stmt(void) //for_stmt -> FOR '('expression';'expression';'expression')''{'statement_list'}'
{
	TreeNode * t = newStmtNode(ForK);
	match(FOR); match(LPAREN);
	if(t!=NULL) t->child[0] = assign_list();
	match(SEMI);
	if(t!=NULL) t->child[1] = exp();
	match(SEMI);
	if(t!=NULL) t->child[2] = assign_list();
	match(RPAREN); match(LBRACE);
	if(t!=NULL) t->child[3]=statement_list();
	//match(RBRACE);
	return t;
}
コード例 #2
0
ファイル: parser.c プロジェクト: chrisdiamand/wm
void rcp_parse(struct rc_t *R, ScannerInput *I)
{
    scan_input = I;
    next_token();

    assign_list();
}
コード例 #3
0
/* MAIN PROGRAM */
int main()
{
	Node_ptr my_list = NULL;

	assign_list(my_list);

	cout << "\nTHE LIST IS NOW:\n";
	print_list(my_list);

	cout << "forwards: ";
	print_forwards(my_list);
	cout << endl;

	cout << "backwards: ";
	print_backwards(my_list);
	cout << endl;

	char word[20], lookfor[20];

	cout << endl << "word to insert: ";
	cin.getline(word,20);

	cout << endl << "to be inserted after (' ' for right at beginning): ";
	cin.getline(lookfor,20);

	add_after(my_list, lookfor, word);

	cout << endl << "\nTHE LIST IS NOW:\n";
	print_list(my_list);

	cout << endl << "word to delete: ";
	cin.getline(word,20);

	delete_node(my_list, word);

	cout << endl << "\nTHE LIST IS NOW:\n";
	print_list(my_list);

	return 0;
}
コード例 #4
0
ファイル: parse.cpp プロジェクト: lvchmi/simpleCompilier
TreeNode * assign_stmt(void) //(后有分号的算数表达式)
{
	TreeNode * t = assign_list();
	match(SEMI);
	return t;
}