Re: buggy 4.0 program

new topic     » goto parent     » topic index » view thread      » older message » newer message
kinz said...
mattlewis said...

Euphoria is a single pass parser, so at the time, we cannot know what will come next, or how long it will go on. Forward references are now legal, and will ultimately make coding easier. For example, if you include something in your program, you will no longer have to worry about them both including each other, requiring reorganization of code, or lots of routine ids.

Matt, Euphoria is a two pass system (2.5 and up) - it parses and compiles into IL on the first pass, and then it runs the IL code on the second pass.

You're changing the definition. The parser is single pass. Please, don't argue this point, because you're wrong. The parser reads the code sequentially once. Hence, single pass.

kinz said...

Now it seems to be parsing to the end of code and it doesn't stop on the first error.
Why do you say that we cannot know what will come next, or how long it will go on?
After the parse\compile pass, the first pass, we have the entire picture of code and all compile time bugs - undeclared names, unresolved conflicts, syntax errors etc.
If there is no a bug in the source code, IL code runs. If there is something wrong in the source code, we have all data to point properly to all wrong places exactly.
No?

It stops as soon as it finds an error. However, the point at which we can prove an error has changed due to forward referencing. It's a subtle but important distinction. If the only problem was that there were typos or undeclared variables or routines, then yes, we can report on all of the places in the code where that happened. If you have a syntax error, however, we report that immediately, without continuing to look at any more code, just like always.

kinz said...

Also, the parser itself seems to be two pass now - ifdefs and then code itself.

No, it's still single pass. The effect of the ifdefs is to ignore code within an ifdef that evaluates to false. So if you have ifdef DEBUG# in your code, then if DEBUG isn't defined, the code within that ifdef is treated as though it were commented out.

kinz said...

A nice side effect of forward referencing is that we can report all your typos at one go, so that you can fix them all at once, without the cycle of run-fix-run-...

Matt, there seems to be a contradiction in your words, you say "we cannot know" above, and now, you say "we can report".
[/quote]

Perhaps I was unclear. We cannot know at the point of reading a variable name that it is undeclared in the program. We can only know that when we have read all of the code.

kinz said...

Maybe, but I do not like forward reference, same as goto, sorry, and probably will not use them both in my progs, probably never.
My 10 years old habit declare then use is strong and very useful for my health, thanks to Rob smile

That's fine, although if you use the standard library, you will almost definitely be using code that uses forward referencing.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu