in line <number>, Expression expected.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

in line <number>, Expression expected.

ElliottS
I have started project 8 and am at the point where I am trying to translate the FibonacciSeries.vm file. When I try to load the script to compare it using the CPU emulator I get an error that says "in line 107, Expression expected". I have no idea what this means, or how I can fix it.
In my generated .asm file line 107 reads "@null$END_PROGRAM"

I have null as the function name, as I have not yet implemented the function calling and returning part of the VM translator.

I will attempt to upload the .asm file that my VM translator outputs.

Any help or suggestions as to where I have gone wrong would be greatly appreciated.

FibonacciSeries.asm

Reply | Threaded
Open this post in threaded view
|

Re: in line <number>, Expression expected.

cadet1620
Administrator
Error numbers reported by tools are often off by 1 or 2 lines so check up and down from line 107.

In this case, the error is on line 108.  You've got a colon where you want a semi-colon.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: in line <number>, Expression expected.

ElliottS
cadet1620 wrote
Error numbers reported by tools are often off by 1 or 2 lines so check up and down from line 107.

In this case, the error is on line 108.  You've got a colon where you want a semi-colon.

--Mark
ahhh, that would do it! Thanks for your help.
Reply | Threaded
Open this post in threaded view
|

Re: in line <number>, Expression expected.

Dasso
In reply to this post by ElliottS
Hello,

I'm having a similar issue I am at the point where I am trying to translate the FibonacciElement folder. When I try to load the FibonacciElement.asm to compare it using the CPU emulator I get an error that says "in line 0, ")" expected". I have no idea why this issue occurs. To debug this issue I translate again BasicLoop.vm, FibonacciElement.vm  and SimpleFunction.vm. All tests pass successfully with the actual VM translator that generate the error "in line 0, ")" expected".

In my generated .asm file line 0 correspond to "(Sys.init)" and line 1 to "@4"

I will attempt to upload the .asm file that my VM translator outputs.

Any help or suggestions as to where I have gone wrong would be greatly appreciated.

Best regards.

FibonacciElement.asm


Reply | Threaded
Open this post in threaded view
|

Re: in line <number>, Expression expected.

cadet1620
Administrator
@SP
M=M+1
@RET#0    <-----
D=A
@SP
'#' is not a valid character for ASM symbols.

From chapter 4:

Constants and Symbols  Constants must be non-negative and are always written in decimal notation. A user-defined symbol can be any sequence of letters, digits, underscore ( _ ), dot ( . ), dollar sign ( $ ), and colon ( : ) that does not begin with a digit.

I suggest using '$' since '_' and '.' are valid in Jack identifiers which are the source of all function names and labels in VM source code, and I find ':' confusing since it's normally used to indicate the end of labels and/or statements in most languages.

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: in line <number>, Expression expected.

Dasso
Thanks for your responsiveness :)

After changing "#" for "$" and adding the bootstrap code that I completely forgot because I didn't understand it I thought I needed to parse first the Sys.vm.

After all these changes I successfully finished the FibonacciElement step.

I hope I will finish chapter 8 this weekend the most challenging chapter in terms of requirements' comprehension, Particularity for the second part of the VM Translator.

Bye :)

Dasso