Parser(int bufsize): This constructor initializes all the necessary data members of the Parser object and allocates a buffer which is used to store lines as they are read from the input stream. The number of bytes allocated for the buffer is determined by the bufsize parameter. By default, the buffer size is set to 512 bytes.
boolean ckt(Runtime_Component &cmp): This method acts as the main driver function which is responsible for reading the stanza headers and then invoking the correct methods for building the subentities of the runtime component. Its duties include dispatching the read_netlist() and read_component() methods, which are described next.
boolean read_netlist(wire_type t, Runtime_Component &cmp): The purpose of this member function is to parse a netlist stanza body read from standard input and store all the netlist attributes. The t parameter indicates whether the method is to read an input, output or internal stanza. After creating a new wire representing the netlist, this method will dispatch the appropriate Runtime_Component member function to create the necessary port or to add the netlist wire to the list of internal netlists maintained by the runtime component. For example, if the method was requested to read an output stanza, it will dispatch the cmp.create_output() member function. Upon encountering a value attribute line in an input stanza, the read_netlist() method will dispatch the read_signals() method.
boolean read_signals(Wire *wire): This member function will parse a list of signal values and times that follow the values attribute keyword in an input stanza. As each signal value and time is parsed, they are added to the wire parameter supplied to this method. These signals represent the primary inputs of the circuit.
boolean read_component(Runtime_Component &cmp): This member function parses the attributes in the body of a component stanza and constructs the desired subcomponent. Each component stanza body consists of three attributes. The type and id attributes are read by the member function read_component_attribute(), which is described next. The port attribute, which lists the names of the connectors attached to the ports of the subcomponent, are read and stored in a linked list of strings. Once all the subcomponent's attributes and port connector names have been identified, they are sent, as parameters, to the runtime component's create_subcmp() method.
boolean read_component_attribute(boolean &c, char *&v): This member function is used to read the type and id attributes of a component stanza body. The boolean parameter, c, is used to ensure that the component attribute was not already read earlier. The v parameter represents the actual value of the attribute. This parameter is simply a string which is dynamically allocated and assigned the appropriate value by this function.