coolray.org FAQ Contact Us
CoolRay Banner
CoolRay / Documentation
Main Page   Class Hierarchy   Compound List   Compound Members   Related Pages  

Parser Class Reference

Scene Description Language Parser. More...

#include <Parser.h>

Collaboration diagram for Parser:

Collaboration graph
[legend]
List of all members.

Public Methods

 Parser (Scanner &rScanner,OutputStream &error_stream)
 Create a new instance of the parser. More...

 ~Parser ()
 Destructor.

bool parse ()
 Parses the Scene Program. More...

ObjectFilegetProgram ()
 Get the resulting compiled scene program, needed as input for the virtual machine. More...


Protected Methods

Token* getToken ()
void backToken (SPToken &token)
unsigned long findProperty (Class *pSearchClass,Class *pClass)
void outputWarning (int level,SPToken &token,int errid,const char *message=NULL)
bool parseDescriptionFile ()
bool parseSceneFile ()
bool parseScene ()
bool parseLibraryFile ()
bool parseLibrary ()
bool parseMetaSection ()
bool parseMetaTag ()
bool parseAuthorTag ()
bool parseDateTag ()
bool parseVersionTag ()
bool parseLanguageTag ()
void parseLibraryImportSection ()
void parseLibraryImportSectionItemList ()
bool parseLibraryImportSectionItem ()
bool parseUsesDeclaration ()
bool parseImportDeclaration ()
bool parseSceneInstanciation ()
bool parseInterfaceSection ()
bool parseImplementationSection ()
void parseDefinitionSection (DeclarationAction &action)
bool parseDefinition (DeclarationAction &action)
bool parseInstanciation (Class *&rpClass,SPToken &rErrorToken)
 Parses the Instanciation of Objects in the Scene Description Language. More...

bool parseStatement ()
bool parseCompoundStatement (BlockAction &action)
 Parses a Compound Statement (blocks of curly brackets). More...

bool parseAssignmentStatement (Expression *&rpExpression)
bool parseIterationStatement ()
bool parseSelectionStatement ()
bool parseForStatement ()
bool parseStep (Expression *&rpExpression)
bool parseWhileStatement ()
bool parseRepeatStatement ()
bool parseIfStatement ()
bool parseElseOpt ()
bool parseFunctionDeclaration (DeclarationAction &rAction)
bool parseVariableDeclaration (DeclarationAction &rAction)
bool parseIdentifierSeq (vector< string > &idents)
bool parseFormalParameterSeq (SymbolFunction *pFunction,int &pcount)
bool parseFormalParameter (SymbolFunction *pFunction,int &pcount)
bool parseFunctionBody (SymbolFunction *pFunction)
bool parseExpression (Expression *&rpExpression)
bool parseConditionalExpression (Expression *&rpExpression)
bool parseLogicalOrExpression (Expression *&rpExpression)
bool parseLogicalOrExpressionR (Expression *&rpExpression,Expression *pLeft)
bool parseLogicalAndExpression (Expression *&rpExpression)
bool parseLogicalAndExpressionR (Expression *&rpExpression,Expression *pLeft)
bool parseRelationalExpression (Expression *&rpExpression)
bool parseRelationalExpressionR (Expression *&rpExpression,Expression *pLeft)
bool parseAdditiveExpression (Expression *&rpExpression)
bool parseAdditiveExpressionR (Expression *&rpExpression,Expression *pLeft)
bool parseMultiplicativeExpression (Expression *&rpExpression)
bool parseMultiplicativeExpressionR (Expression *&rpExpression,Expression *pLeft)
bool parsePotExpression (Expression *&rpExpression)
bool parsePotExpressionR (Expression *&rpExpression,Expression *pLeft)
bool parseUnaryExpression (Expression *&rpExpression)
bool parsePostfixExpression (Expression *&rpExpression)
void parsePostfixExpressionR (Expression *&rpExpression,Expression *pLeft)
bool parsePrimaryExpression (Expression *&rpExpression)
bool parseFunctionCall (Expression *&rpExpression)
void parseParameterList (vector< Expression *> &parameter)
bool parseConstant (Expression *&rpExpression)
bool parseBoolean (Expression *&rpExpression)
bool parseInteger (Expression *&rpExpression)
bool parseDouble (Expression *&rpExpression)
bool parseVectorN (vector< Expression *> &components,SPToken &rErrorToken)
void parseVectorComponentList (vector< Expression *> &components)
bool parseVector (Expression *&rpExpression)
bool parseColor (Expression *&rpExpression)
bool parseString (Expression *&rpExpression)
bool parseTypename (Type &rtype)
void checkExpression_DoubleOrIntegerExpected_DoubleNeeded (Expression *&rpExpression)
Type checkAddOperands (SPToken &token,Expression *&rpLeft,Expression *&rpRight)
Type checkRelationalOperands (SPToken &token,Expression *&rpLeft,Expression *&rpRight)
void checkAssignment (Expression *&pLeft,Expression *&pRight,SPToken &token)
void checkFunctionParameter (SymbolFunctionBase *pSymbolFunc,vector< Expression *> &parameter,SPToken &token)
ExpressioncheckAndConvertIntegerOrDouble (Expression *pInput,const Type &destType,SPToken &token)
void optimizeExpression (Expression *&rpExpression,Assembler *pAssembler)

Protected Attributes

Scanner& scanner
OutputStream& serr
SymbolTable<SymbolBase> symbols
AssemblerpAssembler
ClasspSceneClass
Errors* pErrors
ObjectFilem_pObjectFile
 the object file generated by the parser.


Friends

class  ParserException

Detailed Description

Scene Description Language Parser.

The Parser class encapsulates the syntactial and semantical analysis of a scene description language (SDL) program, also known as Scene. It parses the Scene and generates code for a virtual machine which than produces the scene graph needed for the raytracing algorithm.


Constructor & Destructor Documentation

Parser::Parser ( Scanner & rScanner,
OutputStream & error_stream )
 

Create a new instance of the parser.

Parameters:
rScanner   Reference to a Scanner performing the lexical analysis.
error_stream   OutputStream used to report error messages.


Member Function Documentation

ObjectFile * Parser::getProgram ( )
 

Get the resulting compiled scene program, needed as input for the virtual machine.

See also:
VirtualMachine

bool Parser::parse ( )
 

Parses the Scene Program.

Returns:
true if scene was a valid scene file, false if errors occured

bool Parser::parseCompoundStatement ( BlockAction & action ) [protected]
 

Parses a Compound Statement (blocks of curly brackets).

A Compound Statement is the basic building block for object initialization and functions, loops, if's and other commands. Therefore the concrete actions performed in a compound statement rely on the context where it is used. Therefore a "action" object is used to perform this context depended actions.

If it is just used a statement group (e.g. if or loops), no special actions are to be performed. Therefore there exists a NullBlockAction which does nothing.

(BNF) TODO

Parameters:
in, out   ] action the action class used to perform special operations in the compound statement

bool Parser::parseInstanciation ( Class *& rpClass,
SPToken & rErrorToken ) [protected]
 

Parses the Instanciation of Objects in the Scene Description Language.

(BNF) instanciation ::= identifier compound-statement

Parameters:
out   ] rpClass the class identified by the identifier
out   ] rErrorToken a error token that should used if a semantical error occurs (it point to the identifier token - the object name)

The object instance is the top element on the VM stack.


The documentation for this class was generated from the following file:
  • Parser.h
You are visitor No.

counter

Copyright (c) 2001 Stefan Michel, All Rights Reserved.
Last modified: