SFE.BOAL
Class Parser

java.lang.Object
  extended by SFE.BOAL.Parser

public class Parser
extends java.lang.Object

Parser The straight-line input code with inputs and generic gate-descriptions has the following format:

(running line number) [output] input

or

(running line number) [output] gate arity n table [ 0..(2^n)-1 enumeration of 0/1 outputs ] inputs [ line-num1 .. line-numn ]
// outputs for each possible n-bit input
// n inputs, designated by line-number

Note: a line with a "gate name", of the form:
(running line) and line-num1 line-num2
is simply a macro, that expands into:

(running line) gate arity 2 table [ 0 0 0 1 ] inputs [ line-num1 line-num2 ]
Explanation: The gate has 2 inputs; The output enumeration is:
00 : output 0
01 : output 0
10 : output 0
11 : output 1

Author:
: Dahlia Malkhi and Yaron Sella

Nested Class Summary
 class Parser.ParseError
           
 
Constructor Summary
Parser(java.io.StreamTokenizer st)
          Constructor for class Parser
 
Method Summary
 Circuit getCircuit()
          getCircuit returns the circuit that the parser builds.
static void main(java.lang.String[] args)
          A main program for testing the parser in standalone mode.
 void parse()
          The parse() method is the main body of the parser.
static void parserUsage()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser(java.io.StreamTokenizer st)
Constructor for class Parser

Parameters:
st - - a StreamTokenizer that this parser operates on.
Method Detail

parse

public void parse()
           throws Parser.ParseError
The parse() method is the main body of the parser. It is called at the beginning of the gate definition file, and it consumes the entire input file while building an internal representation of the input using the Circuit package

Throws:
- - ParseError.
Parser.ParseError

getCircuit

public Circuit getCircuit()
getCircuit returns the circuit that the parser builds.

Returns:
the Circuit built by the parser.

parserUsage

public static void parserUsage()

main

public static void main(java.lang.String[] args)
A main program for testing the parser in standalone mode. Note - this main calls Formatter.getInput_noOT(), which is an older version of getInput() that does not perform OT.

Parameters:
args - - command line arguments. args[0] should be circuit filename args[1] should be format filename