JimSchofield / lox

A typescript implementation of Lox from www.craftinginterpreters.com
1 stars 0 forks source link

Error running some files #1

Open AyushKoul00 opened 3 months ago

AyushKoul00 commented 3 months ago

I cloned your code and followed the instructions to run the example files. I was able to run classTest.lox and classTest2.lox but when I run fib.lox or fib2.lox, I get errors. For example, when I run fib.lox, I get these errors:

Running file: .\testFiles\fib.lox

[line 5] Error at 'index': Can't read local variable in its own initializer.
[line 6] Error at 'a': Can't read local variable in its own initializer.
[line 7] Error at 'a': Can't read local variable in its own initializer.
[line 8] Error at 'b': Can't read local variable in its own initializer.
[line 9] Error at 'index': Can't read local variable in its own initializer.
[line 5] Error at 'temp': Can't read local variable in its own initializer.
[line 5] Error at 'b': Can't read local variable in its own initializer.
AyushKoul00 commented 3 months ago

These are all the files that have this issue:

Its the same error: "Can't read local variable in its own initializer."

Can you tell me how I can fix this?

JimSchofield commented 3 months ago

Hi there @AyushKoul00 , It's been a long time and I don't remember exactly what state I left this little project in. I'm sorry, but I don't think I can give support for this. Best of luck playing with interpreters!

AyushKoul00 commented 3 months ago

I see. No problem. But do you remember it working when u coded it? or can u just run it if possible to see if I am doing something wrong?