Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Readme.md: fix test result#84

Open
savemejeff wants to merge 1 commit intoDoctorWkt:masterfrom
savemejeff:master
Open

Readme.md: fix test result#84
savemejeff wants to merge 1 commit intoDoctorWkt:masterfrom
savemejeff:master

Conversation

Copy link

savemejeff commented Jul 30, 2025 *
edited
Loading

When parsing input03, the parser2 won't report syntax error until it reachs the plus sign.

struct ASTnode *additive_expr(void) {
struct ASTnode *left, *right;
int tokentype;

left = multiplicative_expr();

tokentype = Token.token;
if (tokentype == T_EOF)
return (left);

// Cache the '+' or '-' token type
/** here the actual cached token is int literal '34' **/

while (1) {
// Fetch in the next integer literal
scan(&Token);
/** scan()s plus sign **/

right = multiplicative_expr();
/** primary() reports syntax error since Token is T_PLUS **/

left = mkastnode(arithop(tokentype), left, right, 0);

tokentype = Token.token;
if (tokentype == T_EOF)
break;
}

return (left);
}

Copy link
Author

savemejeff commented Jul 31, 2025

After a second thought, I think it may better to fix the parser2 itself, not the test result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant