Skip to content
Snippets Groups Projects
Commit a571d886 authored by mandeca's avatar mandeca :speech_balloon:
Browse files

if-else mejor.

parent 68c765d1
No related branches found
No related tags found
No related merge requests found
......@@ -161,9 +161,8 @@ SENTENCE
}
| IF '(' EXPR ')' SENTENCE ELSE SENTENCE
{
ast = newRoot('r', ast, newNode(IF, $3.u.node, $5.u.node));
$$.type = AST_NODE_id;
$$.u.node = newNode(ELSE, $3.u.node, $7.u.node);
$$.u.node = newNode('g', NULL, newRoot('r', newRoot('r', NULL, newNode(IF, $3.u.node, $5.u.node)), newNode(ELSE, $3.u.node, $7.u.node)));
}
| IF '(' EXPR ')' SENTENCE
{
......
......@@ -13,7 +13,7 @@ typedef struct ast_s {
unsigned lineNum;
union {
struct {
struct ast_s *left, *right;
struct ast_s *left, *right, *rightElse;
} child;
char *str;
double real;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment