Problem with Computercraft: '=' expected near 'monitor' - lua

I am new to computercraft and have a problem with my code.
The error is
'=' expected near 'monitor'
Do anyone know the problem and can fix it?

Related

Why is print() in Lua behaving like This?

In Lua interpreter when I type
>print (12
>>3)
stdin:2: ')' expected (to close '(' at line 1) near '3'
Why am I getting this error?
When we type
>a=2
>a=a+
>>1
This works fine! Then why not print? What is wrong with print()?
The input is print (12 <NEWLINE> 3), which is a syntax error.
Adding a comma after 12 works fine.

stdin:1: '=' expected near '<'

So I'm starting to Learn Lua, my problem is that in a tutorial that teaches you to create Guess My Number Game starts with this line:
name = "John"
print<name>
So in the tutorial shows that prints the name but in mine gives this error:
stdin:1: '=' expected near '<'
Please, what am I getting this?
Thank you for all your help.
Functions use parentheses to enclose their arguments, so the second line should be
print (name)

Xcode / C errors: Expected expression, Missing terminating '"' character

I'm incredibly new to C and Xcode in general. Could somebody explain why this isn't working, and how to fix it?
You have a number of issues.
Regarding the Expected Expression error, you declared _declination and _latitude as UITextField. To get the integer value, you can use: _declination.text.intValue. In context:
if (_declination.text.intValue >= 90 - _latitude.text.intValue)
Regarding Missing terminating character " you need to change:
#The star is circumpolar"
to:
#"The star is circumpolar"
You are missing a quote:
"The star is circumpolar!"

How to continue parsing after an error in Antlr 4.4

Does any one knows if there is an ErrorStrategy on Antlr4.4 to continue parsing after an error is found, i need to show all the errors found in the program but Antlr stop parsing after the first error is found, im using the DefaultErrorStrategy.
This is my input, I should get error ond line 2 3 and 6 but it only reports the error on line 2.
class Program {
bool
bool test
int prueba ;
int prueba ;
int test;
bool prueba
}
The error is:
line 2:1 mismatched input 'bool' expecting {'boolean', 'int', 'void', '}'}
bool
^^^^
Antlr 4's parser error strategy is to drop tokens from the input until it can detect a sane state and then it continues parsing. Looking at your example, while trying to recover maybe it never reaches a sane state before EOF.
Seems like antlr can't recover if there are 2 contiguous error in the program. If the errors are not contiguous it works fine. Thank you very much for your help.

javacc parseException... lookahead problem?

I'm writing a parser for a very simple grammar in javacc. It's beginning to come together but at the moment I'm completely stuck on this error:
ParseException: Encountered "" at line 4, column 15.
Was expecting one of:
The line of input in question is z = y + z + 5
and the production that is giving me problems is my expression which get called from
varDecl():
<ID> <EQL> expression()
Expression looks like this:
<VAR> (<PLUS> expression())?| <NUM> (<PLUS> expression())?
| call() (<PLUS> expression())?
I'm at a loss as to why I'm getting this error - any insight would be greatly appreciated.
Hm, yes, that's not a very helpful error from JavaCC. What version of JavaCC are you using?
Also, it's difficult to troubleshoot these problems without seeing the full grammar... and although I understand you might not be in a position to post that.

Resources