scale.frontend
Class Parser

java.lang.Object
  extended by scale.frontend.Parser
Direct Known Subclasses:
C99, F95

public abstract class Parser
extends java.lang.Object

This is the base class for all source code parsers.

$Id: Parser.java,v 1.9 2007-09-20 18:49:42 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.


Field Summary
protected  java.lang.String extension
           
protected  Scale top
           
 
Constructor Summary
Parser(Scale top, java.lang.String extension)
           
 
Method Summary
static Parser getParser(java.lang.String filename, Scale top)
          Return the parser to use for the specified file.
abstract  SourceLanguage getSourceLanguage()
          Return the correct source langauge instance for this parser.
abstract  CallGraph parse(java.lang.String name, Suite suite, Vector<java.lang.String> macroText)
          Parse the specified file.
static void runPreprocessor(java.io.PrintStream out, java.lang.String filename, Scale top)
          Return the reader to use for the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

top

protected Scale top

extension

protected java.lang.String extension
Constructor Detail

Parser

public Parser(Scale top,
              java.lang.String extension)
Method Detail

parse

public abstract CallGraph parse(java.lang.String name,
                                Suite suite,
                                Vector<java.lang.String> macroText)
Parse the specified file. If macroText is not null, the set of defined macros is added to it.

Parameters:
name - the name of the Clef AST (i.e., the file name)
suite - is the collection of call graphs
macroText - is null or is used to collect macro definitions as text strings
Returns:
new CallGraph

getParser

public static Parser getParser(java.lang.String filename,
                               Scale top)
Return the parser to use for the specified file. The file extension is used to look up the appropriate parser.


runPreprocessor

public static void runPreprocessor(java.io.PrintStream out,
                                   java.lang.String filename,
                                   Scale top)
                            throws java.io.IOException
Return the reader to use for the specified file. The file extension is used to look up the appropriate reader.

Throws:
java.io.IOException

getSourceLanguage

public abstract SourceLanguage getSourceLanguage()
Return the correct source langauge instance for this parser.