Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 11 of 11

Thread: How to start a Java parser

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    24
    My Mood
    Angelic
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default How to start a Java parser

    Hi all,
    Am new to the java world and I wanted to know if there is a parser provided by Java to extract certain piece of information in the code. What I want to do is to give the parser any piece of code and it should be able to read it, find the loops and Boolean expression and be able to change them according to certain rules provided in advance. Is there a way that I can start with??
    Thanks in advance


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: How to start a Java parser

    Are you are asking about how to edit the text files containing source code?

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Posts
    24
    My Mood
    Angelic
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: How to start a Java parser

    Well I want the parser to read and change then save it to another source file. It needs to change only certain parts like I mentioned above. Thanks for the quick reply.

  4. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: How to start a Java parser

    I would suggest some reading from the String class and the Scanner class. Also get a specific idea of what will be changed. Keep the requirements in mind as you look the classes over and even take notes on what methods might be available. Try to organize a plan from there. Note that you may not find everything you need in the classes, but this should get you a starting point. Plenty of room for questions here. Good luck

  5. #5
    Junior Member
    Join Date
    Oct 2012
    Posts
    24
    My Mood
    Angelic
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: How to start a Java parser

    Thanks a lot. I will go through the mentioned classes and will see how it goes. By default Java doesn't have a parser right??

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: How to start a Java parser

    By parser you mean some code that converts syntax to semantics?
    I have not seen anything in the java SE classes that does that.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: How to start a Java parser

    Quote Originally Posted by Sharmeen View Post
    By default Java doesn't have a parser right??
    Surely a language like Java is well documented. What does your favorite search engine find?

  8. #8
    Junior Member
    Join Date
    Oct 2012
    Posts
    24
    My Mood
    Angelic
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: How to start a Java parser

    Quote Originally Posted by Norm View Post
    By parser you mean some code that converts syntax to semantics?
    I have not seen anything in the java SE classes that does that.
    Well something like that with my own rules.

  9. #9
    Junior Member
    Join Date
    Oct 2012
    Posts
    24
    My Mood
    Angelic
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: How to start a Java parser

    Quote Originally Posted by jps View Post
    Surely a language like Java is well documented. What does your favorite search engine find?
    Well it told me that it doesn't and it gave me other options to be used like ANTLR which I don't want to go through.

  10. #10
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: How to start a Java parser

    Quote Originally Posted by Sharmeen View Post
    Well something like that with my own rules.
    Take a moment from this question and do some of the posted reading. Once you see what is available, ask any questions you have left.
    Good luck with the research

  11. #11
    Junior Member
    Join Date
    Oct 2012
    Posts
    24
    My Mood
    Angelic
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: How to start a Java parser

    Quote Originally Posted by jps View Post
    Take a moment from this question and do some of the posted reading. Once you see what is available, ask any questions you have left.
    Good luck with the research
    Sure thing Sir. Thank you very much

Similar Threads

  1. Java Web Start app exiting with access denie (java.lang.RuntimePermission
    By sonaljain in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 13th, 2011, 08:43 PM
  2. java lexical analyzer and parser tool
    By swar sarkos in forum Java Theory & Questions
    Replies: 0
    Last Post: March 17th, 2011, 11:59 AM
  3. XMI parser in java
    By chiru in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 13th, 2011, 11:54 PM
  4. Parser for java Class
    By duarte in forum Java Theory & Questions
    Replies: 1
    Last Post: November 16th, 2010, 07:22 PM
  5. Java Parser
    By sid0009 in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: August 20th, 2010, 11:06 AM

Tags for this Thread