munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.87k stars 1.04k forks source link

Error compiling Fibonacci example #1078

Closed jthomas08 closed 2 years ago

jthomas08 commented 2 years ago

I downloaded c source from here and ran the Fibonacci example in chapter 24 on calls and functions and got compile time errors: [line 3] Error at '(': Expect ';' after return value. [line 6] Error at '(': Expect ';' after variable declaration. [line 7] Error at '(': Expect ';' after value. [line 8] Error at '(': Expect ';' after value.

any ideas?

AfanasiyZaharov commented 2 years ago

Good day, @jthomas08 I had a similar problem compiling code in this chapter, turns out it was my mistake not adding precedence for TOKEN_LEFT_PAREN (it should be PREC_CALL) I'm not sure it's related to your problem, cause you've downloaded code from here, but maybe it can be useful

jthomas08 commented 2 years ago

Thanks for reaching out. The code I got from here has that: /> Calls and Functions infix-left-paren [TOKEN_LEFT_PAREN] = {grouping, call, PREC_CALL},

jthomas08 commented 2 years ago

Never mind..my IDE was caching stale code...its working now

AfanasiyZaharov commented 2 years ago

@jthomas08 Its great to hear! I guess you may close this Issue now

jthomas08 commented 2 years ago

closed