coast MANUAL

Project version 0.1.0
Manual version 0.1.0

Copyright © 2003, Gabriele Budelacci <g.bude@eudoramail.com>


Preface

Copyright © 2003, Gabriele Budelacci <g.bude@eudoramail.com>

This manual is free documentation; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free software Foundation; either version 2 of the license, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details. You can obtain a copy of the GNU General Public License by writing to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

If you use this software in a commercial distribution, it would be nice to send the authors a complimentary copy of your product.


Introduction

coast project provide a set of classes that can be used to represent elements and structure of a source code. These elements may be used to model the structure of a source code document that may be output as source code in any supported language.
I decided to develop coast since I worked with .Net CodeDOM namespace, used to develop the lisa compiler for the .Net framework (this was my thesys project). coast can generate source code (obviously) and assembly in the CPU native code, without the use of any intermediate language.

Feel free to contribute, coast is released under the GPL license!


coast Classes

Here is an alphabetic list of ast (Architecture STructure) classes:

ClassDescription
CoastApplicationUsed to represent an entire application (linkable or executable).
CoastArgumentDeclarationExpressionUsed to declare an argument for a function.
CoastArgumentReferenceExpressionUsed to reference an argument.
CoastArrayIndexerExpressionUsed to represent an array and specified index or indices.
CoastAssignStatementUsed to represent an assignment statement.
CoastBinaryOperatorExpressionUsed to represent an expression that consists of two operands and one operator.
CoastBreakStatementUsed to represent a classic break statement.
CoastCommentStatementUsed to represent a comment statement.
CoastConditionStatementUsed to represent a conditional branch statement.
CoastContinueStatementUsed to represent a classic continue statement.
CoastEntryPointFunctionUsed to represent the entry point of an executable application.
CoastElementAbstract class for other ast classes.
CoastExpressionAbstract class that represents an expression.
CoastExpressionStatementUsed to wrap an expression into a statement.
CoastFunctionUsed to represent a function.
CoastFunctionInvokeExpressionUsed to represent a function invoke.
CoastIterationStatementUsed to represent a classic loop statement, like for and while statements.
CoastMemberAbstract class that represents a member of an application.
CoastOperatorExpressionAbstract class that represents a unary or binary operator expression.
CoastPrimitiveExpressionUsed to represent a primitive data type value.
CoastReturnStatementUsed to represent a return statement from a function.
CoastSnippetExpressionUsed to represent a literal expression.
CoastSnippetMemberUsed to represent a member of an application using a literal code fragment.
CoastSnippetStatementUsed to represent a statement using a literal code fragment.
CoastStatementAbstract class that represents a statement.
CoastSwitchCaseOptionUsed to represent a case option of a switch statement.
CoastSwitchDefaultOptionUsed to represent the default option of a switch statement.
CoastSwitchOptionAbstract class that represents an option of a switch statement.
CoastSwitchStatementUsed to represent the classic switch statement, with exclusive or sequential options.
CoastTypeReferenceUsed to reference a data type.
CoastUnaryOperatorExpressionUsed to represent an expression that consists of one operator and one operand.
CoastVariableDeclarationStatementUsed to represent a declaration of a variable.
CoastVariableReferenceExpressionUsed to reference a variable.


Here is an alphabetic list of ast collection classes:

ClassDescription
CoastArgumentDeclarationExpressionCollectionCollection of ast argument declarations.
CoastElementCollectionCollection of ast elements.
CoastExpressionCollectionCollection of ast expressions.
CoastMemberCollectionCollection of ast application members.
CoastStatementCollectionCollection of ast statements.
CoastSwitchCaseOptionCollectionCollection of ast case options.


Here is an alphabetic list of ast managing classes:

ClassDescription
CCodeProviderProvide a C language support for ast classes.
CoastProviderAbstract class for code providers.


Here is an alphabetic list of ast enumerations:

EnumDescription
CoastBinaryOperatorTypeDescribe the supported binary operators.
CoastUnaryOperatorTypeDescribe the supported unary operators.


CCodeProvider

Provide a C language support for ast classes.

Defined in: c_code_provider.hpp

class CCodeProvider : public CoastProvider
{
public:

    // compile_assembly:
    //  Compile assembly fom the specified source.
    virtual bool compile_assembly( CoastElement* ast );

    // generate_code:
    //  Generate source code from the specified source.
    virtual string generate_code( CoastElement* ast );

protected:

    // get_assembly:
    //  Get the assembly code of a element.
    virtual string get_assembly( CoastApplication*                   application );
    virtual string get_assembly( CoastArgumentDeclarationExpression* expression  );
    virtual string get_assembly( CoastArgumentReferenceExpression*   expression  );
    virtual string get_assembly( CoastArrayIndexerExpression*        expression  );
    virtual string get_assembly( CoastAssignStatement*               statement   );
    virtual string get_assembly( CoastBinaryOperatorExpression*      expression  );
    virtual string get_assembly( CoastBreakStatement*                statement   );
    virtual string get_assembly( CoastCommentStatement*              statement   );
    virtual string get_assembly( CoastConditionStatement*            statement   );
    virtual string get_assembly( CoastContinueStatement*             statement   );
    virtual string get_assembly( CoastEntryPointFunction*            function    );
    virtual string get_assembly( CoastElement*                       element     );
    virtual string get_assembly( CoastExpressionStatement*           statement   );
    virtual string get_assembly( CoastFunction*                      function    );
    virtual string get_assembly( CoastFunctionInvokeExpression*      expression  );
    virtual string get_assembly( CoastIterationStatement*            statement   );
    virtual string get_assembly( CoastPrimitiveExpression*           expression  );
    virtual string get_assembly( CoastReturnStatement*               statement   );
    virtual string get_assembly( CoastSnippetExpression*             expression  );
    virtual string get_assembly( CoastSnippetMember*                 member      );
    virtual string get_assembly( CoastSnippetStatement*              statement   );
    virtual string get_assembly( CoastSwitchCaseOption*              option      );
    virtual string get_assembly( CoastSwitchDefaultOption*           option      );
    virtual string get_assembly( CoastSwitchStatement*               statement   );
    virtual string get_assembly( CoastTypeReference*                 reference   );
    virtual string get_assembly( CoastUnaryOperatorExpression*       expression  );
    virtual string get_assembly( CoastVariableDeclarationStatement*  statement   );
    virtual string get_assembly( CoastVariableReferenceExpression*   expression  );

};


CoastApplication

Used to represent an entire application (linkable or executable).

Defined in: coast.hpp

class CoastApplication : public CoastElement
{
public:

    // Default constructor.
    CoastApplication();

    // Destructor.
    virtual ~CoastApplication();


    // functions:
    //  Collection of application functions.
    CoastMemberCollection* members;

};


CoastArgumentDeclarationExpression

Used to declare an argument for a function.

Defined in: coast.hpp

class CoastArgumentDeclarationExpression : public CoastExpression
{
public:

    // Constructor.
    CoastArgumentDeclarationExpression( CoastTypeReference* type, string name );

    // Destructor.
    virtual ~CoastArgumentDeclarationExpression();


    // type:
    //  Argument type.
    CoastTypeReference* type;

    // name:
    //  Argument name.
    string name;

};


CoastArgumentDeclarationExpressionCollection

Collection of ast argument declarations.

Defined in: coast.hpp

class CoastArgumentDeclarationExpressionCollection : public CoastExpressionCollection
{
public:

    // add:
    //  Add a argument declaration expression to this collection.
    virtual void add( CoastArgumentDeclarationExpression* expression );

protected:

    // add:
    //  Add an element to this collection.
    virtual void add( CoastExpression* expression );
    virtual void add( CoastElement* element );

};


CoastArgumentReferenceExpression

Used to reference an argument.

Defined in: coast.hpp

class CoastArgumentReferenceExpression : public CoastExpression
{
public:

    // Constructor.
    CoastArgumentReferenceExpression( string name );

    // Destructor.
    virtual ~CoastArgumentReferenceExpression();


    // name:
    //  Argument name.
    string name;

};


CoastArrayIndexerExpression

Used to represent an array and specified index or indices.

Defined in: coast.hpp

class CoastArrayIndexerExpression : public CoastExpression
{
public:

    // Constructors.
    CoastArrayIndexerExpression( CoastExpression* target, CoastExpression* index );

    // Destructor.
    virtual ~CoastArrayIndexerExpression();


    // target:
    //  Target object expression.
    CoastExpression* target;

    // indices:
    //  The index or indices of the indexer expression.
    CoastExpressionCollection* indices;

};


CoastAssignStatement

Used to represent an assignment statement.

Defined in: coast.hpp

class CoastAssignStatement : public CoastStatement
{
public:

    // Constructors:
    CoastAssignStatement( CoastExpression* lvalue, CoastExpression* rvalue );

    // Destructor:
    virtual ~CoastAssignStatement();


    // lvalue:
    //  Left expression value.
    CoastExpression* lvalue;

    // rvalue:
    //  Right expression value.
    CoastExpression* rvalue;

};


CoastBinaryOperatorExpression

Used to represent an expression that consists of two operands and one operator.

Defined in: coast.hpp

class CoastBinaryOperatorExpression : public CoastOperatorExpression
{
public:

    // Constructors.
    CoastBinaryOperatorExpression( CoastExpression* lvalue, CoastBinaryOperatorType op, CoastExpression* rvalue );

    // Destructor.
    virtual ~CoastBinaryOperatorExpression();


    // lvalue:
    //  Left value.
    CoastExpression* lvalue;

    // op:
    //  The operator.
    CoastBinaryOperatorType op;

    // rvalue:
    //  Right value.
    CoastExpression* rvalue;

};


CoastBinaryOperatorType

Describe the supported binary operators.

Defined in: coast.hpp

typedef enum
{
    BinaryOperator_NONE,        // C++ equivalence:
    Add,                        //  +
    Assign,                     //  =
    BitwiseAnd,                 //  &
    BitwiseExor,                //  ^
    BitwiseOr,                  //  |
    BooleanAnd,                 //  &&
    BooleanOr,                  //  ||
    Divide,                     //  /
    GreaterThan,                //  >
    GreaterThanOrEqual,         //  >=
    IdentityEquality,           //  ==
    IdentityInequality,         //  !=
    LessThan,                   //  <
    LessThanOrEqual,            //  <=
    Modulus,                    //  %
    Multiply,                   //  *
    ShiftLeft,                  //  <<
    ShiftRight,                 //  >>
    Subtract                    //  -
} CoastBinaryOperatorType;


CoastBreakStatement

Used to represent a classic break statement.

Defined in: coast.hpp

class CoastBreakStatement : public CoastStatement
{
public:

    // Constructors:
    CoastBreakStatement();

    // Destructor:
    virtual ~CoastBreakStatement();

};


CoastCommentStatement

Used to represent a comment statement.

Defined in: coast.hpp

class CoastCommentStatement : public CoastStatement
{
public:

    // Constructors:
    CoastCommentStatement();
    CoastCommentStatement( string comment );

    // Destructor:
    virtual ~CoastCommentStatement();


    // comment:
    //  The comment.
    string comment;

};


CoastConditionStatement

Used to represent a conditional branch statement.

Defined in: coast.hpp

class CoastConditionStatement : public CoastStatement
{
public:

    // Constructors.
    CoastConditionStatement();
    CoastConditionStatement( CoastExpression* condition );

    // Destructor.
    virtual ~CoastConditionStatement();


    // condition:
    //  The condition.
    CoastExpression* condition;

    // true_statements:
    //  Container for true statements.
    CoastStatementCollection* true_statements;

    // false_statements:
    //  Container for false statements.
    CoastStatementCollection* false_statements;

};


CoastContinueStatement

Used to represent a classic continue statement.

Defined in: coast.hpp

class CoastContinueStatement : public CoastStatement
{
public:

    // Constructors:
    CoastContinueStatement();

    // Destructor:
    virtual ~CoastContinueStatement();

};


CoastEntryPointFunction

Used to represent the entry point of an executable application.

Defined in: coast.hpp

class CoastEntryPointFunction : public CoastFunction
{
public:

    // Default constructor
    CoastEntryPointFunction();

};


CoastElement

Abstract class for other ast classes.

Defined in: coast.hpp

class CoastElement
{
public:

    // polymorphic
    //  Needed to make this class polymorphic.
    virtual void polymorphic(){}

};


CoastElementCollection

Collection of ast elements.

Defined in: coast.hpp

class CoastElementCollection : public list<CoastElement*>
{
public:

    // Default constructor:
    CoastElementCollection();

    // Destructor:
    virtual ~CoastElementCollection();

    // add:
    //  Add an element to this collection.
    virtual void add( CoastElement* element );

};


CoastExpression

Abstract class that represents an expression.

Defined in: coast.hpp

class CoastExpression : public CoastElement
{
};


CoastExpressionCollection

Collection of ast expressions.

Defined in: coast.hpp

class CoastExpressionCollection : public CoastElementCollection
{
public:

    // add:
    //  Add a expression to this collection.
    virtual void add( CoastExpression* expression );

protected:

    // add:
    //  Add an element to this collection.
    virtual void add( CoastElement* element );

};


CoastExpressionStatement

Used to wrap an expression into a statement.

Defined in: coast.hpp

class CoastExpressionStatement : public CoastStatement
{
public:

    // Constructors:
    CoastExpressionStatement( CoastExpression* expression );

    // Destructor:
    virtual ~CoastExpressionStatement();


    // expression:
    //  The expression.
    CoastExpression* expression;

};


CoastFunction

Used to represent a function.

Defined in: coast.hpp

class CoastFunction : public CoastMember
{
public:

    // Constructor
    CoastFunction( string name );

    // Destructor
    virtual ~CoastFunction();


    // return_type:
    //  Return type for this function.
    CoastTypeReference* return_type;

    // name:
    //  Function name
    string name;

    // arguments:
    //  Collection of argument declarations.
    CoastArgumentDeclarationExpressionCollection* arguments;

    // statements:
    //  Collection of function statements.
    CoastStatementCollection* statements;

};


CoastFunctionInvokeExpression

Used to represent a function invoke.

Defined in: coast.hpp

class CoastFunctionInvokeExpression : public CoastExpression
{
public:

    // Constructor
    CoastFunctionInvokeExpression( string name );
    CoastFunctionInvokeExpression( string name, CoastExpression* argument );
    CoastFunctionInvokeExpression( string name, CoastExpressionCollection* arguments );

    // Destructor
    virtual ~CoastFunctionInvokeExpression();


    // name:
    //  Function name
    string name;

    // arguments:
    //  The arguments to be passed to this function.
    CoastExpressionCollection* arguments;

};


CoastIterationStatement

Used to represent a classic loop statement, like for and while statements.

Defined in: coast.hpp

class CoastIterationStatement : public CoastStatement
{
public:

    // Constructors:
    CoastIterationStatement();
    CoastIterationStatement( CoastStatement* init, CoastExpression* condition, CoastStatement* increment );
    CoastIterationStatement( CoastStatement* init, CoastExpression* condition, CoastStatement* increment, CoastStatementCollection* statements );

    // Destructor:
    virtual ~CoastIterationStatement();


    // init:
    //  The loop initialization statement.
    CoastStatement* init;

    // condition:
    //  Expression to test to exit condition.
    CoastExpression* condition;

    // increment:
    //  The per-cycle increment statement.
    CoastStatement* increment;

    // statements:
    //  The statements within the loop.
    CoastStatementCollection* statements;

};


CoastMember

Abstract class that represents a member of an application.

Defined in: coast.hpp

class CoastMember : public CoastElement
{
};


CoastMemberCollection

Collection of ast application members.

Defined in: coast.hpp

class CoastMemberCollection : public CoastElementCollection
{
public:

    // add:
    //  Add a member to this collection.
    virtual void add( CoastMember* member );

protected:

    // add:
    //  Add an element to this collection.
    virtual void add( CoastElement* element );

};


CoastOperatorExpression

Abstract class that represents a unary or binary operator expression.

Defined in: coast.hpp

class CoastOperatorExpression : public CoastExpression
{
};


CoastPrimitiveExpression

Used to represent a primitive data type value.

Defined in: coast.hpp

class CoastPrimitiveExpression : public CoastExpression
{
public:

    // Constructors.
    CoastPrimitiveExpression();
    CoastPrimitiveExpression( bool   boolean          );
    CoastPrimitiveExpression( char   character        );
    CoastPrimitiveExpression( short  short_integer    );
    CoastPrimitiveExpression( int    integer          );
    CoastPrimitiveExpression( long   long_integer     );
    CoastPrimitiveExpression( float  single_precision );
    CoastPrimitiveExpression( double double_precision );
    CoastPrimitiveExpression( string str              );

    // Destructor.
    virtual ~CoastPrimitiveExpression();


    // type:
    //  Type of primitive element.
    int data_type;              // see follow

    // Primitive data.          // related type:
    bool   boolean;             // 1
    char   character;           // 2
    short  short_integer;       // 3
    int    integer;             // 4
    long   long_integer;        // 5
    float  single_precision;    // 6
    double double_precision;    // 7
    string strn;                // 8

};


CoastProvider

Abstract class for code providers.

Defined in: coast.hpp

class CoastProvider
{
public:

    // compile_assembly:
    //  Compile assembly fom the specified source.
    virtual bool compile_assembly( CoastElement* ast ) = 0;

    // generate_code:
    //  Generate source code from the specified source.
    virtual string generate_code( CoastElement* ast ) = 0;

protected:

    // get_assembly:
    //  Get the assembly code of a element.
    virtual string get_assembly( CoastApplication*                   application ) = 0;
    virtual string get_assembly( CoastArgumentDeclarationExpression* expression  ) = 0;
    virtual string get_assembly( CoastArgumentReferenceExpression*   expression  ) = 0;
    virtual string get_assembly( CoastArrayIndexerExpression*        expression  ) = 0;
    virtual string get_assembly( CoastAssignStatement*               statement   ) = 0;
    virtual string get_assembly( CoastBinaryOperatorExpression*      expression  ) = 0;
    virtual string get_assembly( CoastBreakStatement*                statement   ) = 0;
    virtual string get_assembly( CoastCommentStatement*              statement   ) = 0;
    virtual string get_assembly( CoastConditionStatement*            statement   ) = 0;
    virtual string get_assembly( CoastContinueStatement*             statement   ) = 0;
    virtual string get_assembly( CoastEntryPointFunction*            function    ) = 0;
    virtual string get_assembly( CoastElement*                       element     ) = 0;
    virtual string get_assembly( CoastExpressionStatement*           statement   ) = 0;
    virtual string get_assembly( CoastFunction*                      function    ) = 0;
    virtual string get_assembly( CoastFunctionInvokeExpression*      expression  ) = 0;
    virtual string get_assembly( CoastIterationStatement*            statement   ) = 0;
    virtual string get_assembly( CoastPrimitiveExpression*           expression  ) = 0;
    virtual string get_assembly( CoastReturnStatement*               statement   ) = 0;
    virtual string get_assembly( CoastSnippetExpression*             expression  ) = 0;
    virtual string get_assembly( CoastSnippetMember*                 member      ) = 0;
    virtual string get_assembly( CoastSnippetStatement*              statement   ) = 0;
    virtual string get_assembly( CoastSwitchCaseOption*              option      ) = 0;
    virtual string get_assembly( CoastSwitchDefaultOption*           option      ) = 0;
    virtual string get_assembly( CoastSwitchStatement*               statement   ) = 0;
    virtual string get_assembly( CoastTypeReference*                 reference   ) = 0;
    virtual string get_assembly( CoastUnaryOperatorExpression*       expression  ) = 0;
    virtual string get_assembly( CoastVariableDeclarationStatement*  statement   ) = 0;
    virtual string get_assembly( CoastVariableReferenceExpression*   expression  ) = 0;

};


CoastReturnStatement

Used to represent a return statement from a function.

Defined in: coast.hpp

class CoastReturnStatement : public CoastStatement
{
public:

    // Constructors:
    CoastReturnStatement();
    CoastReturnStatement( CoastExpression* expression );

    // Destructor:
    virtual ~CoastReturnStatement();


    // expression:
    //  Optional return expression.
    CoastExpression* expression;

};


CoastSnippetExpression

Used to represent a literal expression.

Defined in: coast.hpp

class CoastSnippetExpression : public CoastExpression
{
public:

    // Constructor:
    CoastSnippetExpression( string expression );

    // Destructor:
    virtual ~CoastSnippetExpression();


    // expression:
    //  The expression.
    string expression;

};


CoastSnippetMember

Used to represent a member of an application using a literal code fragment.

Defined in: coast.hpp

class CoastSnippetMember : public CoastMember
{
public:

    // Constructor:
    CoastSnippetMember( string member );

    // Destructor:
    virtual ~CoastSnippetMember();


    // statement:
    //  The statement.
    string member;

};


CoastSnippetStatement

Used to represent a statement using a literal code fragment.

Defined in: coast.hpp

class CoastSnippetStatement : public CoastStatement
{
public:

    // Constructor:
    CoastSnippetStatement( string statement );

    // Destructor:
    virtual ~CoastSnippetStatement();


    // statement:
    //  The statement.
    string statement;

};


CoastStatement

Abstract class that represents a statement.

Defined in: coast.hpp

class CoastStatement : public CoastElement
{
};


CoastStatementCollection

Collection of ast statements.

Defined in: coast.hpp

class CoastStatementCollection : public CoastElementCollection
{
public:

    // add:
    //  Add a statement to this collection.
    virtual void add( CoastStatement* statement );

protected:

    // add:
    //  Add an element to this collection.
    virtual void add( CoastElement* element );

};


CoastSwitchCaseOption

Used to represent a case option of a switch statement.

Defined in: coast.hpp

class CoastSwitchCaseOption : public CoastSwitchOption
{
public:

    // Constructors:
    CoastSwitchCaseOption( CoastExpression* value );
    CoastSwitchCaseOption( CoastExpression* value, CoastStatementCollection* statements );

    // Destructor:
    virtual ~CoastSwitchCaseOption();


    // value:
    //  The value to be checked for this option.
    CoastExpression* value;

    // statement:
    //  The statements associated to this option.
    CoastStatementCollection* statements;

};


CoastSwitchCaseOptionCollection

Collection of ast case options.

Defined in: coast.hpp

class CoastSwitchCaseOptionCollection : public CoastElementCollection
{
public:

    // add:
    //  Add a function to this collection.
    virtual void add( CoastSwitchCaseOption* option );

protected:

    // add:
    //  Add an element to this collection.
    virtual void add( CoastElement* element );

};


CoastSwitchDefaultOption

Used to represent the default option of a switch statement.

Defined in: coast.hpp

class CoastSwitchDefaultOption : public CoastSwitchOption
{
public:

    // Constructors:
    CoastSwitchDefaultOption();
    CoastSwitchDefaultOption( CoastStatementCollection* statements );

    // Destructor:
    virtual ~CoastSwitchDefaultOption();


    // statement:
    //  The statements associated to this option.
    CoastStatementCollection* statements;

};


CoastSwitchOption

Abstract class that represents an option of a switch statement.

Defined in: coast.hpp

class CoastSwitchOption : public CoastElement
{
};


CoastSwitchStatement

Used to represent the classic switch statement, with exclusive or sequential options.

Defined in: coast.hpp

class CoastSwitchStatement : public CoastStatement
{
public:

    // Constructors:
    CoastSwitchStatement();
    CoastSwitchStatement( CoastExpression* expression );
    CoastSwitchStatement( CoastExpression* expression, bool exclusive );

    // Destructor:
    virtual ~CoastSwitchStatement();


    // exclusive:
    //  Determine if the options are mutually-exclusive.
    bool exclusive;

    // expression:
    //  The expression used to switch on.
    CoastExpression* expression;

    // case_options:
    //  The case options associated to this statement.
    CoastSwitchCaseOptionCollection* case_options;

    // default_option:
    //  The default option associated to this statement.
    CoastSwitchDefaultOption* default_option;

};


CoastTypeReference

Used to reference a data type.

Defined in: coast.hpp

class CoastTypeReference : public CoastElement
{
public:

    // Constructor:
    CoastTypeReference( string type );

    // Destructor:
    virtual ~CoastTypeReference();


    // type:
    //  The type.
    string type;

};


CoastUnaryOperatorExpression

Used to represent an expression that consists of one operator and one operand.

Defined in: coast.hpp

class CoastUnaryOperatorExpression : public CoastOperatorExpression
{
public:

    // Constructors.
    CoastUnaryOperatorExpression( CoastUnaryOperatorType op, CoastExpression* value );

    // Destructor.
    virtual ~CoastUnaryOperatorExpression();


    // op:
    //  The operator.
    CoastUnaryOperatorType op;

    // value:
    //  The value.
    CoastExpression* value;

};


CoastUnaryOperatorType

Describe the supported unary operators.

Defined in: coast.hpp

typedef enum
{
    UnaryOperator_NONE,         // C++ equivalence:
    Address,                    //  &
    BitwiseNot,                 //  ~
    BooleanNot,                 //  !
    Negative,                   //  -
    Positive,                   //  +
    PostDecrement,              //  --
    PostIncrement,              //  ++
    PreDecrement,               //  --
    PreIncrement,               //  ++
    Reference,                  //  *
    SizeOf                      //  sizeof
} CoastUnaryOperatorType;


CoastVariableDeclarationStatement

Used to represent a declaration of a variable.

Defined in: coast.hpp

class CoastVariableDeclarationStatement : public CoastStatement
{
public:

    // Constructor.
    CoastVariableDeclarationStatement( CoastTypeReference* type, string name );
    CoastVariableDeclarationStatement( CoastTypeReference* type, string name, CoastExpression* expression );

    // Destructor.
    virtual ~CoastVariableDeclarationStatement();


    // type:
    //  Argument type.
    CoastTypeReference* type;

    // name:
    //  Argument name.
    string name;

    // expression:
    //  Init expression.
    CoastExpression* expression;

};


CoastVariableReferenceExpression

Used to reference a variable.

Defined in: coast.hpp

class CoastVariableReferenceExpression : public CoastExpression
{
public:

    // Constructor.
    CoastVariableReferenceExpression( string name );

    // Destructor.
    virtual ~CoastVariableReferenceExpression();


    // name:
    //  Variable name.
    string name;

};