This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Art Of Java - Expression Parser

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A question for the author...I'm an intermediate java developer...having dabbled in swing, servlets and several java xml apis but master of none :-). One thing that interest me about this book is the Expression Parser example....one thng I've had to do alot is parse strings from other apps and I've been looking for a way to build a "configurable" parser - something I can resuse with different projects...will this example help me accomplish this?
Thanks,
-Will
 
Author
Posts: 253
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Will:
The expression parser is found in Chapter 2 of the book. It is a numeric expression parser. This means that it parses and evaluates strings that contain numeric expressions, such as
(10 - 5) * 3
x = y / 17
w % 3
The parser can be used whenever you need to evaluate a numeric expression that is represented in its human-readable string form. For example, you could use it as the basis for a calculator utility that you might build into a larger app. It can also be used to add a level of convenience to many numeric input chores. For example, consider an application that asks the user to enter the number of copies of a document to print. Normally, you would simply display a text field, wait for input, and then convert that text into its binary numeric format. This simple approach would allow the user to enter a value, such as 100. However, what if the user wanted to print 72 copies for each of 9 departments? The user would need to manually compute that product and then enter the value 648 into the text field. However, if you use the parser to compute the input obtained from the text field, then the user could enter 9*72, and no manual computation is required. The ability to parse and evaluate a numeric expression can add a sophisticated, professional feel to even the simplest application.
The parser also forms the backbone of the language interpreter found in Chapter 3.
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mr.Herb,
Is the content in the chapter-2 enough for doing a project in a Computer Science courses like "Theory of Computation", "Compiler Construction" and so on? I'm currently enrolled in the "Theory of Computation" class in MSCS program... And I am supposed to do a term project on that topic...
I'm wondering if u have any opinion on the level of that chapter, related to the formal languages and parsers stuff...
Thank you in advance...
 
Herb Schildt
Author
Posts: 253
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ko Ko:
I think that you will find Chapter 2 (the numeric expression parser) and Chapter 3 (the language interpreter) interesting. They also contain a lot of background information which you might find helpful.
However, if your "Theory of Computation" course is similar to the one that I took when I was a student, then I wouldn't say that they would be of any significant aid in your coursework. As I recall, both "Theory of Computation" and "Compiler Construction" were more theoretical than practical.
What these chapters will do is show you how to put into practice many of the theoretical concepts that you will be learning. Frankly, there is often a riff between the theoretical models of the classroom and the realworld implementation of those models. This is where the material in The Art of Java will help.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Herb Schildt:
[QB]Ko Ko:
However, if your "Theory of Computation" course is similar to the one that I took when I was a student, then I wouldn't say that they would be of any significant aid in your coursework. As I recall, both "Theory of Computation" and "Compiler Construction" were more theoretical than practical.
[QB]


Actually, yes, the course is based on the theory and concept... But the lecturer wants us to implement it in the real application and submit to him as a simulation and he offers some credits for that... One brilliant software that I downloaded is JFlap and it's very famous among "Theory of Computation" stuffs...
I do hope that the chapter-2 and 3 are really helpful for us in implementing the concepts from those subjects...
Thanks a lot for your explanation...
 
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!