lab4
程序员文章站
2024-02-09 18:09:58
...
int f(int x,int y)
{
x=5;
return x;
}
TreeNode * newNode(NodeKind kind)
{
TreeNode * t = (TreeNode *)malloc(sizeof(TreeNode));
int i;
if (t == NULL)
{
;
}
else {
for (i = 0; i<4; i++)
{
t->child[i] = NULL;
}
t->sibling = NULL;
t->nodekind = kind;
t->lineno = lineno;
if (kind == OpK || kind == IntK || kind == IdK)
{
if (kind == IdK)
t->attr.name = "";
}
if (kind == ConstK)
t->attr.val = 0;
}
return t;
}
void match(TokenType expected){
if(token==expected)
token=GetToken();
else
printf("unexpected token");
}