This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Parsing scripts files through java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Parsing scripts files through java" Watch "Parsing scripts files through java" New topic
Author

Parsing scripts files through java

bhushan shelke
Greenhorn

Joined: Feb 04, 2001
Posts: 7
Hello All,

I'm working with embeded system, which has standard command set.

I need to store some of those commands in some kind of script file and then parse them sequentially(thr' java) and pass those commands to embeded system (thr' java).
Everything looks simple so far, but real challenge is handling conditional statements for e.g script/command file could be something like -

SET X
MOVETO 1000
X =GETPOSITION
IF(X<1000)
MOVETO (1000-X)

CAPTURE
....

This looks pretty much same as parsing grammar, how can this be achieved in java? Especially conditional parsing and then choosing appropriate path in script.

Thnx in advance.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18114
    
    8

Yes, it is the same as parsing grammar. So that's what you will have to do.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

There are tools, for example JavaCC, that let you specify the grammar of the language and then generate Java source code that implements a parser for the language.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parsing scripts files through java
 
Similar Threads
cannot resolve symbol: Linux
Tomcat
Path and Classpath
Set environment variable of UNIX by java program
can't use java 1.5?