Re: Syntax checker wtf?



On 8/21/06, Mike Cargal <mike@xxxxxxxxxx> wrote:
My point was not to say that it was a problem for Ruby to not have
statement terminators. I was trying to answer
the question as to why the user was getting his error reported at EOF.
It's also pertinent because a lot of
discussion has been around the need for "better error messages". While
I have certainly seen cases where Ruby
error messages could be better, I don't think a little more work on
error messages is going to correct his issue.
It's implicit with the lack of statement terminators.

Just about every language and compiler I've run across in 30+ years
has shown some head-scratching syntax errors, usually caused by a
mis-matched pair of somethings. The solution has always been some form
of tool besides the syntax error messages:

The old-fashioned way was for the compiler to produce a listing with
annotations on the side showing nesting levels of things like do/end
procedures/functions and their ends etc.

Proc Do
0 0 Function foo(a,b)
1 0 do while something
1 1 sing(a)
1 1 do something else
1 2 skip(b)
1 1 end
1 1 frobnitz()
1 0 end
0 0 end

Of course that looks ancient to anyone but us old greybeards who cut
our teeth on keypunches instead of vi or emacs.

The more modern way is to eschew listings in favor of editors which
are somewhat knowledgable of the language syntax and can do things
like fold, indent, and find matching items.

Back when I did Lisp, I learned techniques like numbering parentheses myself:
(a (b c)( (( (d e) f) ) ) ))))))))))
0 1 11234 4 3210

And of course those old Lots of Irritating Silly Parentheses
evaluators would throw away those unneeded closing parens.
--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

.



Relevant Pages

  • Re: Syntax checker wtf?
    ... My point was not to say that it was a problem for Ruby to not have statement terminators. ... discussion has been around the need for "better error messages". ... positive quality of the language I consider unacceptable. ...
    (comp.lang.ruby)
  • Re: reading a structure with pointer
    ... The code you posted has syntax errors. ... If the OP's problem is that attempting to compile gives error ... errors is fine (as long as the actual text of the error messages is ... The result of "gcc filename.c" is irrelevant here unless you get the ...
    (comp.lang.c)
  • line numbering
    ... I just used Visual C++ to compile a C code. ... I code a bunch of error messages (mostly syntax errors). ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Arrays again - I must be dumb
    ... compiler error messages and correct the syntax errors. ... for help figuring out what various error message really mean. ...
    (comp.lang.java.help)