Table of Contents

Class Parser

Namespace
BOOSE
Assembly
BOOSE.dll

The parser takes a program, who's lines are seperated by "\n", and attempts to create a StoredProgram. Once the SToredProgram has been created it then can be run. As much processing that can be done is done here because it has no run penalty (other than starting the program). Command objects are created and their parameters processed as much as possible. Variables are checked for existance but expressions cannot be processed until runtime.

public class Parser : IParser
Inheritance
Parser
Implements
Inherited Members

Constructors

Parser(CommandFactory, StoredProgram)

Create Parser object with associated StoredProgram.

public Parser(CommandFactory Factory, StoredProgram Program)

Parameters

Factory CommandFactory

CommandFactory that the paser will call to make command objects..

Program StoredProgram

StoredProgram to add generated commands to.

Exceptions

ParserException

Thrown on syntax errors. message contains a complete list with line numbers, seperated by return characters.

Methods

ParseCommand(string)

Take a line and attempt to parse a BOOSE command. The command is split from its parameters. It determines if variables are being defined or updated. The Command Factory is called to make the Command object and its Compile() method is called to further process its parameters. Normal commands are of the form [command][space][parameter list] Variable declarations\redefinitions are of the form [variablename][=][expression] where expression is optional. To create your own parser it would be possible to just implement the IParser interface. You could extend Parser as well.

public virtual ICommand ParseCommand(string Line)

Parameters

Line string

Returns

ICommand

Exceptions

ParserException

Throws exceptions if an undefined variable is used in an expression.

ParseProgram(string)

The whole program is processed line by line. ParseCommand() is called for each line.

public virtual void ParseProgram(string program)

Parameters

program string

Exceptions

ParserException

Complete list of syntax errors with line numbers.