Hi, I am implementing a small variation of the Monkey programming language in Rust as an exercise (I don’t have much experience in Rust). I have the parser and the lexer, and the first version of an evaluator. However, it seems that no matter what I do, I always get stack overflow with the following program:


let counter = fn (x : int) -> int {

if (x < 900) {

return counter(x + 1);

} else {

return x;

}

};

counter(2);

Here is the code of the evaluator (simplified for this example): https://github.com/tomaz1502/monkey-rs/blob/rec_limit/src/mods/lib/evaluator.rs

I checked and the AST is being correctly generated by the parser. I don’t think I am making to…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help