org.griphyn.vdl.parser
Class VDLtParser

java.lang.Object
  extended by org.griphyn.vdl.parser.VDLtParser

public class VDLtParser
extends Object

Parses the input stream and generates pool configuration map as output.

Version:
$Revision: 50 $
Author:
Jens-S. V??ckler, Yong Zhao
See Also:
VDLtScanner, VDLtToken

Field Summary
private  VDLtToken m_lookAhead
          Stores the look-ahead symbol.
private  VDLtScanner m_scanner
          The access to the lexical scanner is stored here.
 
Constructor Summary
VDLtParser(Reader r)
          Initializes the parser with an input stream to read from.
 
Method Summary
protected  Pass aarg()
          internal function to parse actual arguments employed by a DV.
protected  Argument argument()
          internal function to parse a argument line.
protected  Call call()
          internal function to parse a call inside a compound TR.
protected  Pass carg()
          internal function to parse a call inside a compound TR.
protected  Derivation derivation()
          internal function to parse a complete transformation.
protected  Scalar dv_leaf()
           
protected  Declare farg()
          internal function to parse formal arguments employed by a TR.
protected  VDLtFQDN fqdn()
          internal function to parse the fully-qualified definition identifier into memory.
 boolean hasMoreTokens()
          Predicate to determine, if there are more Definition instances to be read.
protected  LFN lfn()
           
 Definitions parse()
          Parses the complete input stream.
 Definition parseDefinition()
          Parses the a single definition from the input stream and returns just the definition.
protected  Profile profile()
          internal function to parse a profile inside a TR body.
protected  Local targ()
          internal function to parse temporary variables employed n a TR.
protected  Text text()
           
protected  Leaf tr_leaf()
           
protected  Transformation transformation()
          internal function to parse a complete transformation.
protected  VDLtFQDN trmap()
          internal function to parse the part after the arrow operator into memory.
protected  Use use()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_scanner

private VDLtScanner m_scanner
The access to the lexical scanner is stored here.


m_lookAhead

private VDLtToken m_lookAhead
Stores the look-ahead symbol.

Constructor Detail

VDLtParser

public VDLtParser(Reader r)
           throws IOException,
                  VDLtException
Initializes the parser with an input stream to read from.

Parameters:
r - is the stream opened for reading.
Throws:
IOException
VDLtException
Method Detail

lfn

protected LFN lfn()
           throws IOException,
                  VDLtException
Throws:
IOException
VDLtException

use

protected Use use()
           throws IOException,
                  VDLtException
Throws:
IOException
VDLtException

text

protected Text text()
             throws IOException,
                    VDLtException
Throws:
IOException
VDLtException

tr_leaf

protected Leaf tr_leaf()
                throws IOException,
                       VDLtException
Throws:
IOException
VDLtException

dv_leaf

protected Scalar dv_leaf()
                  throws IOException,
                         VDLtException
Throws:
IOException
VDLtException

profile

protected Profile profile()
                   throws IOException,
                          VDLtException
internal function to parse a profile inside a TR body.

Returns:
a memory representation of a profile instance.
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

argument

protected Argument argument()
                     throws IOException,
                            VDLtException
internal function to parse a argument line.

Returns:
a memory representation of an TR argument.
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

carg

protected Pass carg()
             throws IOException,
                    VDLtException
internal function to parse a call inside a compound TR.

Returns:
an actual argument list as used by the call statement.
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

call

protected Call call()
             throws IOException,
                    VDLtException
internal function to parse a call inside a compound TR.

Returns:
a memory representation of a call instance.
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

farg

protected Declare farg()
                throws IOException,
                       VDLtException
internal function to parse formal arguments employed by a TR.

Returns:
a single formal argument
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

targ

protected Local targ()
              throws IOException,
                     VDLtException
internal function to parse temporary variables employed n a TR.

Returns:
a single formal argument
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

aarg

protected Pass aarg()
             throws IOException,
                    VDLtException
internal function to parse actual arguments employed by a DV.

Returns:
a single actual argument.
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

fqdn

protected VDLtFQDN fqdn()
                 throws IOException,
                        VDLtException
internal function to parse the fully-qualified definition identifier into memory. This is the name of a TR or DV.

Returns:
a parsed fully-qualified identifier.
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

trmap

protected VDLtFQDN trmap()
                  throws IOException,
                         VDLtException
internal function to parse the part after the arrow operator into memory. It is also used for calls in compound transformations.

On popular demand, the syntax slightly changed to be more permissive with version maps. The following short-cuts are permitted:

Returns:
a parsed mapping to a transformation.
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

derivation

protected Derivation derivation()
                         throws IOException,
                                VDLtException
internal function to parse a complete transformation.

Returns:
a derivation in memory
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

transformation

protected Transformation transformation()
                                 throws IOException,
                                        VDLtException
internal function to parse a complete transformation.

Returns:
a transformation in memory
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

parseDefinition

public Definition parseDefinition()
                           throws IOException,
                                  VDLtException
Parses the a single definition from the input stream and returns just the definition. The piece-by-piece parsing allows for a more memory-efficient parsing process of large input streams.

Returns:
a Definition structure for one TR or DV
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException
See Also:
parse(), hasMoreTokens()

hasMoreTokens

public boolean hasMoreTokens()
                      throws IOException,
                             VDLtException
Predicate to determine, if there are more Definition instances to be read.

Returns:
true, if there are potentially more tokens in the stream.
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException

parse

public Definitions parse()
                  throws IOException,
                         VDLtException
Parses the complete input stream. This method will construct the complete stream as Definitions in memory. It will gobble a lot of memory for large input.

Returns:
the Definitions in one structure
Throws:
IOException - if the reading from the stream fails,
VDLtParserException - if the parser detects a syntax error,
VDLtScannerException - if the scanner detects a lexical error.
VDLtException
See Also:
parseDefinition()


Copyright © 2007 The University of Southern California. All Rights Reserved.