Help Help Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Levar
    New Member
    • Oct 2007
    • 6

    #1

    Help Help Help

    In my program on the last line I have:

    }

    but when I run the program I get an error message of:

    reached end of file while parsing

    can anyone help with correcting this problem?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by Levar
    In my program on the last line I have:

    }

    but when I run the program I get an error message of:

    reached end of file while parsing

    can anyone help with correcting this problem?
    Some of your curly brackets don't pair up; check them out.

    kind regards,

    Jos

    Comment

    • Levar
      New Member
      • Oct 2007
      • 6

      #3
      Originally posted by JosAH
      Some of your curly brackets don't pair up; check them out.

      kind regards,

      Jos



      I reviewed each curly bracket and the one that doesn't match up I added another and then more errors came. So I just took that bracket back out what do you think?

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by Levar
        I reviewed each curly bracket and the one that doesn't match up I added another and then more errors came. So I just took that bracket back out what do you think?
        A compiler first checks the syntactical structure of your source code; missing
        brackets are noticed almost immediately; next, an AST (Abstract Syntax Tree)
        is constructed (if the previous phase completed without errors) and more
        analisys is performed on that AST.

        First you missed a bracket so the AST wasn't even constructed; then you put
        that bracket in and the compiler attempted to construct the AST and further
        errors were found.

        Put that bracket back in and solve those other errors; that's the only reasonable
        way to get a working program. The only alternative is to remove *all* your code
        and compile an empty class "public class Useless { }" but I don't consider that
        a reasonable alternative.

        kind regards,

        Jos

        Comment

        Working...