1. EXACT meaning of 2 error messages
- Posted by eddo Jul 07, 2015
- 2073 views
I'm trying to program around a bug in euphoria's interpreter that reports the errors (1)expected a type here and (2) expected an assignment following sequence (=,+=,-=,*=, /=, &= ) and it would REALLY HELP if I knew EXACTLY what these error messages mean. I mean, what exactly does the interpreter expect and WHY when these error messages appear?????
2. Re: EXACT meaning of 2 error messages
- Posted by BRyan Jul 08, 2015
- 1931 views
I'm trying to program around a bug in euphoria's interpreter that reports the errors (1)expected a type here and (2) expected an assignment following sequence (=,+=,-=,*=, /=, &= ) and it would REALLY HELP if I knew EXACTLY what these error messages mean. I mean, what exactly does the interpreter expect and WHY when these error messages appear?????
The interpreter is seeing {-,+= ............ as the command {equal, plus equal .........
In a sequence you would have to use {"-","+=",...........
3. Re: EXACT meaning of 2 error messages
- Posted by ghaberek (admin) Jul 08, 2015
- 1917 views
I'm trying to program around a bug in euphoria's interpreter that reports the errors (1)expected a type here and (2) expected an assignment following sequence (=,+=,-=,*=, /=, &= ) and it would REALLY HELP if I knew EXACTLY what these error messages mean. I mean, what exactly does the interpreter expect and WHY when these error messages appear?????
Can you post the exact chunk of code causing this issue and the EXACT error message you're receiving?
-Greg
4. Re: EXACT meaning of 2 error messages
- Posted by andi49 Jul 08, 2015
- 1882 views
I'm trying to program around a bug in euphoria's interpreter that reports the errors (1)expected a type here and (2) expected an assignment following sequence (=,+=,-=,*=, /=, &= ) and it would REALLY HELP if I knew EXACTLY what these error messages mean. I mean, what exactly does the interpreter expect and WHY when these error messages appear?????
It would really help to know the exact code that produces this error.
becouse:
-- file typo.exw typo
produces excactly this error:
C:\develop\designer\typo.exw:2 <0076>:: expected to see an assignment after 'typo', such as =, +=, -=, *=, /= o r &= <end-of-file> ^ Press Enter
Andreas
5. Re: EXACT meaning of 2 error messages
- Posted by eddo Jul 08, 2015
- 1879 views
becouse:
-- file typo.exw typo
produces excactly this error:
C:\develop\designer\typo.exw:2 <0076>:: expected to see an assignment after 'typo', such as =, +=, -=, *=, /= o r &= <end-of-file> ^ Press Enter
Andreas
OK -WHY does Euphoria give this error message??? Does anyone know??? I mean, there must be a reason! Is it a secret? It is hair-pulling bugs like this, need I point out, then when encountered by anyone trying out the language with an eye to maybe adopting it, send them scurrying away forever.
6. Re: EXACT meaning of 2 error messages
- Posted by _tom (admin) Jul 08, 2015
- 1907 views
OK -WHY does Euphoria give this error message??? Does anyone know??? I mean, there must be a reason! Is it a secret? It is hair-pulling bugs like this, need I point out, then when encountered by anyone trying out the language with an eye to maybe adopting it, send them scurrying away forever.
Lets start with a test program to examine what the Euphoria parser may be doing:
include std/console.e include euphoria/tokenize.e object crud = ` -- file type.exw typo ` display(crud) crud = tokenize_string( crud ) -- works like interpreter crud = crud[1] -- clean up the output somewhat display( crud ) display( token_names[ crud[1][1] ] ) -- first item is the identity of the token /* -- file type.exw typo { { 9, "typo", 2, 1, -1 } } T_IDENTIFIER */
So Euphoria recognizes the word typo as an identifier.
This identifier (so far) has not been declared to be a data-object nor has it been declared to be some kind of subroutine. It is just a name.
As a first guess assume that the identifier is a variable name.
Now, what can you do with an identifier name?
- assign a value to it
- use the identifier as an argument to subroutine
- output its value
Not enough code in this example for it to be an argument or part of an output statement. That leaves "assignment."
Now if you intended to assign a value to the word typo the next thing that must be written is the assignment operator = (equals symbol or something similar ).
<0076>:: expected to see an assignment after 'typo', such as =, +=, -=, *=, / or &=
Euphoria therefore gives you a "guess" that you wanted to write an assignment statement. Euphoria also gives a a list of possible ways to write that assignment statement.
Frustrating but logical.
_tom
7. Re: EXACT meaning of 2 error messages
- Posted by _tom (admin) Jul 09, 2015
- 1872 views
A comparison of error messages for a minimal one line program:
Program | Language | Message |
---|---|---|
typo | Euphoria |
<0076>:: expected to see an assignment after 'typo', such as =, +=, -=, *=, /= or &= <end-of-file> ^ <eucode> |
Python |
Traceback (most recent call last): File "e1.py", line 2, in <module> typo NameError: name 'typo' is not defined |
|
typo = | Euphoria |
<0135>:: Syntax error - expected to see an expression, not the end of file <end-of-file> ^ |
Python |
File "e2.py", line 2 typo = ^ SyntaxError: invalid syntax |
|
typo = 3 | Euphoria |
<0074>:: Errors resolving the following references: 'typo' (e3.ex:2) has not been declared. typo = 3 ^ |
Python | valid syntax for Python |
You can frustate yourself using any progamming language. However, you may get less frustration using Euphoria.
- If you write typo (as a one line program)
- Euphoria assumption is that you wanted to write "typo" and tells you what should come next.
- Python assumption is that you have already made a mistake. (A helpful message here.)
- If you write typo =
- Euphoria tells you that an expression must come next.
- Python tells you that you made a mistake. ("SyntaxError" is a very common message; Python tends not to be helpful.)
- If you write typo = 3
- Euphoria reminds you that "typo" has not been declared.
- Python says this is a valid program. (But surprise if you did not intend for "typo" to be a variable name.)
Python was designed to teach programming; I would have expected better error messages from Python.
_tom
8. Re: EXACT meaning of 2 error messages
- Posted by petelomax Jul 09, 2015
- 1864 views
- Last edited Jul 16, 2015
In Phix, I've written "test\terror.exw" (m$ windows only) to test errors and warnings. The intention was to write "Source" to a test file, run Phix on it, then test that an ex.err was produced and contained the stuff in "Expected". Of course "Run All" processes the entire list, stopping on the first mismatch. Mainly so that after I finish messing about with the innards I can check that I have not messed up any errors and warnings.
Here is a screenshot, nice and simple, nothing too fancy:
It strikes me that a newbie could do worse than run that program and simply cursor down the list as part of the learning process to gain an understanding and general overview of error messages.
Also, if you run the program and type "undefined" or "identifier" (without the quotes, and you don't need to have focus on the Filter field) then it limits the list to just two entries, so you can use it to find an example of some message you are getting, and hopefully simply because each example is pared right down to the bone it should be easier to see what the compiler (or runtime) is actually trying to say.
Pete
PS in case you haven't got what is going on, the compiler is saying it don't know what you mean by banana, or whether it should set it, clear it, print it, peel it, eat it, or run down the shops, buy one, and throw it out the screen at the monkey sitting in front of the keyboard
9. Re: EXACT meaning of 2 error messages
- Posted by eddo Jul 14, 2015
- 1796 views
OK - sorry for the delay - From what I understand, Euphoria is giving me a "type is expected here" error because it thinks its within the parameter list of a function declaration. Why it thought this, I have no idea, but it must have thought so, or it couldn't have been expecting a type. Right? Maybe if I move the declaration to a new spot in the source, I won't get the invalid error reported? Euphoria is also seeing my "sequence" declaration as a variable which it thinks I must make an assignment to because there's nothing else I could do to a variable at that location, but WHY is it seeing "sequence" as a variable? I would think that I must have some gross error in syntax or spelling before it. I must! But everything looks perfect. I'm telling you my thinking so you know how I'm attempting to "code around" the problem. I remember someone mentioning "rogue sequence sequence's as being something that could mess up Euphoria in making it think "screwy" so it could produce invalid error reports. But the code looks perfect! Is my thinking about what is going on in Euphoria's interpreter sort-of correct? When Euphoria gives the "expected assignment" error, why is it seeing the reserved word "sequence" as a variable? How could this happen? What could I try to try to make the problem go away?
10. Re: EXACT meaning of 2 error messages
- Posted by evanmars Jul 14, 2015
- 1782 views
... What could I try to try to make the problem go away?
You could try posting all of your code, or a bigger chunk than just the function where you are getting the error. Especially the code preceding the function.
More sets of eyes may help find the error. You may be too 'close' to the code. I know I sometimes need help finding a missing comma, etc.
11. Re: EXACT meaning of 2 error messages
- Posted by _tom (admin) Jul 14, 2015
- 1758 views
Your choices are:
- try to make a smaller program that still gives you the same error message
- post your code
Without a code example we are stuck in trying to help you.
_tom
12. Re: EXACT meaning of 2 error messages
- Posted by ghaberek (admin) Jul 14, 2015
- 1769 views
From what I understand, Euphoria is giving me a "type is expected here" error because it thinks its within the parameter list of a function declaration.
That's not entirely true. The following is a perfectly valid Euphoria program. It does nothing, but it's valid code and it runs and exits immediately.
sequence typo
As you can see the type is declared first. So when the interpreter sees an identifier it does not recognize its first assumption is, "did you mean to put a type here?"
-Greg
13. Re: EXACT meaning of 2 error messages
- Posted by andi49 Jul 14, 2015
- 1756 views
OK - sorry for the delay - From what I understand, Euphoria is giving me a "type is expected here" error because it thinks its within the parameter list of a function declaration. Why it thought this, I have no idea, but it must have thought so, or it couldn't have been expecting a type. Right? Maybe if I move the declaration to a new spot in the source, I won't get the invalid error reported? Euphoria is also seeing my "sequence" declaration as a variable which it thinks I must make an assignment to because there's nothing else I could do to a variable at that location, but WHY is it seeing "sequence" as a variable? I would think that I must have some gross error in syntax or spelling before it. I must! But everything looks perfect. I'm telling you my thinking so you know how I'm attempting to "code around" the problem. I remember someone mentioning "rogue sequence sequence's as being something that could mess up Euphoria in making it think "screwy" so it could produce invalid error reports. But the code looks perfect! Is my thinking about what is going on in Euphoria's interpreter sort-of correct? When Euphoria gives the "expected assignment" error, why is it seeing the reserved word "sequence" as a variable? How could this happen? What could I try to try to make the problem go away?
Hi
sometimes only the Parser goes mad and sometimes the comma is far away from your code ....
enum alpha,beta,gamma, -- remove the comma and it works !!!! sequence typo1 function typo(sequence anything) return anything end function
C:\develop\HiEdit\typo.exw:4 <0076>:: expected to see an assignment after 'typo1', such as =, +=, -=, *=, /= or &= function typo(sequence anything) ^ Press Enter
or this one
enum alpha,beta,gamma sequence typo1, -- remove the comma and it works !!!! function typo(sequence anything) return anything end function
C:\develop\HiEdit\typo.exw:4 <0025>:: found ... function ... but was expecting an identifier name function typo(sequence anything) ^ Press Enter
(and such errors also appear with other programming languages)
Example:
like this
program Hello; var integer : typo; // should look like typo : integer; begin writeln ('Hello, world.'); end.
C:\develop\HiEdit>fpc typo.pas Free Pascal Compiler version 2.6.4 [2014/03/06] for i386 Copyright (c) 1993-2014 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling typo.pas typo.pas(4,15) Error: Identifier not found "typo" typo.pas(4,15) Error: Error in type definition typo.pas(7,4) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted Error: C:\FPC\2.6.4\bin\i386-Win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled) C:\develop\HiEdit>
Andreas
14. Re: EXACT meaning of 2 error messages
- Posted by eddo Jul 14, 2015
- 1746 views
"sequence typo" runs without any errors for me. You seem to be saying this should error out with "type expected here" message...(on "typo")
15. Re: EXACT meaning of 2 error messages
- Posted by petelomax Jul 14, 2015
- 1737 views
- Last edited Jul 16, 2015
"sequence typo" runs without any errors for me. You seem to be saying this should error out with "type expected here" message...(on "typo")
erm,
The following is a perfectly valid Euphoria program. It does nothing, but it's valid code and it runs and exits immediately.
sequence typo
Please don't take this the wrong way but I feel I have to raise two points: Firstly, if you are lost in the desert and bump into a nomad who only speaks tuareg, saying "where is the nearest telephone?", however loudly, is unlikely to get you very far. There are obvious parallels between communicating with another human being in a spoken language such as tuareg and communicating with a computer in a programming language such as Euphoria, and exactly the same kinds of angers and frustrations will inevitably occur. In the latter we can sometimes improve matters, but only once we fully understand the difficulty, and have carefully considered all the other cases we must cater for, so as not to mislead someone else even worse.
Secondly, if you go to the doctor and say "My child is ill", the doctor will simply say "where is your child?". I trust the parallels of that need no further explanation.
Pete