ca.ryerson.kclowes.digsim.ui
Class CircuitPreprocessor

java.lang.Object
  extended by ca.ryerson.kclowes.digsim.ui.CircuitPreprocessor

public class CircuitPreprocessor
extends java.lang.Object

Preprocess a circuit description interpreting/expanding macros.

A circuit description to preprocess contains (BNF description):

    description  = defBlock | circuitBlock
    defBlock     = 'defBlock' blockName blockArgs '\n' body 'enddef'
    blockName    = sequence of printable characters EXCEPT whitespace
    blockArgs    = arg*
    arg          = formal name
    body         = circuitBlock*
    circuitBlock = DEFINED IN CircuitParser (as block)
 

A comment can be added with '//'; the rest of the line is ignored.

Version:
1.0 (27 February 2004)
Author:
Ken Clowes (kclowes@ee.ryerson.ca)

Method Summary
 void expand(java.io.Reader in, java.io.Writer out)
          Expand a circuit description.
static CircuitPreprocessor getInstance()
           
static void main(java.lang.String[] args)
          The main method allows the CircuitPreprocessor to be used as an application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CircuitPreprocessor getInstance()

expand

public void expand(java.io.Reader in,
                   java.io.Writer out)
Expand a circuit description.

Parameters:
in - The source of the circuit description.
out - Where the expansion is written.

main

public static void main(java.lang.String[] args)
The main method allows the CircuitPreprocessor to be used as an application.

With no arguments, it works as a filter: a circuit description is read from stdin and its expansion is written to stdout.