org.opencores.edifp
Class Parser

java.lang.Object
  |
  +--org.opencores.edifp.Parser

public class Parser
extends java.lang.Object

Parser class provides basic LL(1) parser for EDIF file


Field Summary
private  int arrayElt
          element in array
private  PathScope curPath
          current namescope
private static boolean debug
          Are we doing debug here?
private static java.io.PrintWriter err
          writter, copied from Conf.log
private  Lex lex
           
private  int numArray
          num elements for last object ID
private  java.lang.String realName
          real last object name
private  PathScope refPath
          referenced namescope
 
Constructor Summary
Parser(Lex lex)
          constructs new parser.
 
Method Summary
private  void _interface()
          dissolves token with same name using LL(1) structure
private  void cell()
          dissolves token with same name using LL(1) structure
private  void cellRef()
          dissolves token with same name using LL(1) structure
private  boolean checkEmpty()
           
private  void contents()
          dissolves token with same name using LL(1) structure
private  void design()
          dissolves token with same name using LL(1) structure
private  void dissolveRef(int level)
          utility for dissolving references
private  Graph edif()
          dissolves token with same name using LL(1) structure
(package private)  void error(int token)
          reports token # expected
(package private)  void error(java.lang.String msg)
          reports an error
private  void external()
          dissolves token with same name using LL(1) structure
private  Symbol get(int id)
          get specific token, otherwise return error
private  java.lang.String getID()
          gets identifier
private  java.lang.String getID(boolean allowArrays)
          gets identifier extended
private  int getNum()
          get NUMBER
private  void instance()
          dissolves token with same name using LL(1) structure
private  void instanceRef()
          dissolves token with same name using LL(1) structure
private  void joined()
          dissolves token with same name using LL(1) structure
private  void library()
          dissolves token with same name using LL(1) structure
private  void libraryRef()
          dissolves token with same name using LL(1) structure
private  void lp()
          look for LPAREN
static Graph main(java.lang.String infile)
          parses EDIF file.
private  void net()
          dissolves token with same name using LL(1) structure
private  void netRef()
          dissolves token with same name using LL(1) structure
private  Symbol next()
          get next token
 Graph parse()
           
private  void port()
          dissolves token with same name using LL(1) structure
private  void portRef()
          dissolves token with same name using LL(1) structure
private  void property(Instance i)
          dissolves token with same name using LL(1) structure
private  java.lang.String rename(boolean allowArray)
          dissolves rename, member or array
private  void rp()
          look for RPAREN
private  void skipBlock(Symbol s)
          skip to last RPAREN
private  void view()
          dissolves token with same name using LL(1) structure
private  void viewRef()
          dissolves token with same name using LL(1) structure
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

debug

private static boolean debug
Are we doing debug here?

lex

private Lex lex

err

private static java.io.PrintWriter err
writter, copied from Conf.log

realName

private java.lang.String realName
real last object name

numArray

private int numArray
num elements for last object ID

arrayElt

private int arrayElt
element in array

curPath

private PathScope curPath
current namescope

refPath

private PathScope refPath
referenced namescope
Constructor Detail

Parser

public Parser(Lex lex)
constructs new parser.
Parameters:
lex - lexical analizer parser is going to be attached to
Method Detail

main

public static Graph main(java.lang.String infile)
                  throws java.lang.Exception
parses EDIF file.
Parameters:
infile - file to parse
Returns:
graph read from file
See Also:
Graph

next

private Symbol next()
             throws java.lang.Exception
get next token

get

private Symbol get(int id)
            throws java.lang.Exception
get specific token, otherwise return error

getNum

private int getNum()
            throws java.lang.Exception
get NUMBER

lp

private void lp()
         throws java.lang.Exception
look for LPAREN

rp

private void rp()
         throws java.lang.Exception
look for RPAREN

checkEmpty

private boolean checkEmpty()
                    throws java.lang.Exception

skipBlock

private void skipBlock(Symbol s)
                throws java.lang.Exception
skip to last RPAREN

getID

private java.lang.String getID(boolean allowArrays)
                        throws java.lang.Exception
gets identifier extended

getID

private java.lang.String getID()
                        throws java.lang.Exception
gets identifier

rename

private java.lang.String rename(boolean allowArray)
                         throws java.lang.Exception
dissolves rename, member or array

error

void error(java.lang.String msg)
reports an error

error

void error(int token)
reports token # expected

parse

public Graph parse()
            throws java.lang.Exception

edif

private Graph edif()
            throws java.lang.Exception
dissolves token with same name using LL(1) structure

library

private void library()
              throws java.lang.Exception
dissolves token with same name using LL(1) structure

external

private void external()
               throws java.lang.Exception
dissolves token with same name using LL(1) structure

cell

private void cell()
           throws java.lang.Exception
dissolves token with same name using LL(1) structure

view

private void view()
           throws java.lang.Exception
dissolves token with same name using LL(1) structure

_interface

private void _interface()
                 throws java.lang.Exception
dissolves token with same name using LL(1) structure

port

private void port()
           throws java.lang.Exception
dissolves token with same name using LL(1) structure

contents

private void contents()
               throws java.lang.Exception
dissolves token with same name using LL(1) structure

instance

private void instance()
               throws java.lang.Exception
dissolves token with same name using LL(1) structure

property

private void property(Instance i)
               throws java.lang.Exception
dissolves token with same name using LL(1) structure

net

private void net()
          throws java.lang.Exception
dissolves token with same name using LL(1) structure

joined

private void joined()
             throws java.lang.Exception
dissolves token with same name using LL(1) structure

design

private void design()
             throws java.lang.Exception
dissolves token with same name using LL(1) structure

dissolveRef

private void dissolveRef(int level)
                  throws java.lang.Exception
utility for dissolving references

libraryRef

private void libraryRef()
                 throws java.lang.Exception
dissolves token with same name using LL(1) structure

cellRef

private void cellRef()
              throws java.lang.Exception
dissolves token with same name using LL(1) structure

viewRef

private void viewRef()
              throws java.lang.Exception
dissolves token with same name using LL(1) structure

portRef

private void portRef()
              throws java.lang.Exception
dissolves token with same name using LL(1) structure

instanceRef

private void instanceRef()
                  throws java.lang.Exception
dissolves token with same name using LL(1) structure

netRef

private void netRef()
             throws java.lang.Exception
dissolves token with same name using LL(1) structure