Results 1 to 6 of 6
  1. #1
    1202910120 is offline Member
    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    Default Line by line parsing of the statements written in an editor of an IDE

    I just wanted to ask that during our typing on the editor of any IDE ,we are always prompted for errors whenever we try to make some syntactical mistakes or any mistakes like reassigning a value to a final variable,or making the local variable static,so actually how does it all happens because all this is the work of compiler and during just writing the program on the editor,how does a particular IDE is able to manage this stuff,is it that during typing only,some interpreter works for whom similar parse tables are made as for the compiler?

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,989
    Rep Power
    8

    Default Re: Line by line parsing of the statements written in an editor of an IDE

    This is not done by the compiler. Instead, the IDE parses your sourcecode and builds an AST. From there they can do all sorts of cool stuff with it. This is in a nutshell what happens. This process is very complex and makes up a LOT of the core of the IDE.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Line by line parsing of the statements written in an editor of an IDE

    And one can easily get used to letting the IDE point out problems so you gloss over the cause and don't remember it as well. It is easy to get addicted to such help. Learning to use the CLI for java development would be a good practice. I still need to do it or I get lazy and forget even this simplest things.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,423
    Blog Entries
    7
    Rep Power
    27

    Default Re: Line by line parsing of the statements written in an editor of an IDE

    Quote Originally Posted by SurfMan View Post
    This is not done by the compiler.
    It is done by part of the compiler: the lexical analyzer and the parser run behind your back and mark the incorrect stuff for you. Normally it doesn't do incremental code generation (it's not worth it while you are editing).

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  5. #5
    1202910120 is offline Member
    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    Default Re: Line by line parsing of the statements written in an editor of an IDE

    Quote Originally Posted by JosAH View Post
    It is done by part of the compiler: the lexical analyzer and the parser run behind your back and mark the incorrect stuff for you. Normally it doesn't do incremental code generation (it's not worth it while you are editing).

    kind regards,

    Jos
    I just wanted to know that if the lexical analyser or parser would generate the parse trees then is it so that they have the information of keywords which the compiler has because the IDE's usually tend to display the error when we try to write any invalid keyword and also then there must be some means by which actually they tend to even prompt for error messages like return statement not found.

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,423
    Blog Entries
    7
    Rep Power
    27

    Default Re: Line by line parsing of the statements written in an editor of an IDE

    Quote Originally Posted by 1202910120 View Post
    I just wanted to know that if the lexical analyser or parser would generate the parse trees then is it so that they have the information of keywords which the compiler has because the IDE's usually tend to display the error when we try to write any invalid keyword and also then there must be some means by which actually they tend to even prompt for error messages like return statement not found.
    Yep, as I wrote, the parser is involved and the parser can only do its job if it knows about keywords; (part of) an abstract syntax tree needs to be built if it wants to detect missing return statements (it can only detect that after the last right curly bracket).

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Replies: 1
    Last Post: 09-17-2013, 01:57 AM
  2. Replies: 16
    Last Post: 09-17-2011, 02:41 AM
  3. Line parsing
    By Unnel in forum New To Java
    Replies: 10
    Last Post: 01-03-2011, 03:54 PM
  4. line editor program help!!
    By xquizitpinay in forum Advanced Java
    Replies: 8
    Last Post: 11-02-2010, 12:08 AM
  5. Parsing a line
    By reis3k in forum New To Java
    Replies: 2
    Last Post: 08-18-2009, 04:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •