亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ptnode.h

?? 這是一些于C++做的經(jīng)典例子
?? H
字號:
#ifndef __PTNode_H__
#define __PTNode_H__


#include <string>
#include <vector>

#include "SmartPtr.H"

// This file defines all the various parse tree (or PT) nodes that are used by
// the compiler.  Every parse tree contains the same basic structure:  a type
// and a set of children.  Because of this, the base parse tree class, PTNode,
// has an enumeration which describes the type of parse tree node, and an
// array of children.
//
// Since most parse tree nodes will have a very fixed number of children
// (e.g., binary operators will always have two children), it is convient to
// derive utility classes from this base parse tree node.  This also has the
// advantage of hiding the parse tree enumeration from the parser, and
// constructors can be used to full effect.


// The parser tends to through around pointers a lot.  Instead of having to
// keep track of when to delete memory, define a bunch of smart pointers.
// Since these smart pointers are reference counted, they will delete the
// memory automatically.
typedef SmartPtr<class PTNode> PTNodePtr;
typedef SmartPtr<class AddNode> AddNodePtr;
typedef SmartPtr<class SubtractNode> SubtractNodePtr;
typedef SmartPtr<class MultiplyNode> MultiplyNodePtr;
typedef SmartPtr<class DivideNode> DivideNodePtr;
typedef SmartPtr<class AssignmentNode> AssignmentNodePtr;
typedef SmartPtr<class ConstantNode> ConstantNodePtr;
typedef SmartPtr<class IdentifierNode> IdentifierNodePtr;
typedef SmartPtr<class IfNode> IfNodePtr;
typedef SmartPtr<class ForNode> ForNodePtr;
typedef SmartPtr<class StatementNode> StatementNodePtr;
typedef SmartPtr<class BlockNode> BlockNodePtr;


// Define a typedef that will keep track of the set of children nodes that a
// parse tree node can contain.
using namespace std;
typedef vector<PTNodePtr> NodeList;


// Define the enumeration for the parse tree node types.  Every type of parse
// tree requires a unique type in here.
enum PTNodeType {
  Undef_PTNodeType,

  Add_PTNodeType,
  Subtract_PTNodeType,
  Multiply_PTNodeType,
  Divide_PTNodeType,
  Assignment_PTNodeType,

  Constant_PTNodeType,
  Identifier_PTNodeType,

  If_PTNodeType,
  For_PTNodeType,
  Statement_PTNodeType,
  Block_PTNodeType
};



// Below are the various parse tree nodes that are used by the compiler.  Only
// the root node contains the type enumeration and the set of children.
// Derived classes simply override the constructor to allow easy construction
// of the specific nodes.  They also add any helpful utiltiy functions for the
// code generator to use.

class PTNode : public RefCount {
public:
  PTNode( PTNodeType type )
  {
    m_type = type;
  }

  virtual string GetName() const = 0;

  void Add( PTNodePtr node )
  {
    m_children.push_back( node );
  }

  PTNodeType GetType() const
  {
    return m_type;
  }

  // This dump function writes to stdout the enitre contents of this parse
  // tree.
  void Dump() const;


protected:
  // The code generator needs to be able to iterate over the children that are
  // contains in this parse tree node.  Define a few accessors so it can get
  // to the iterators.
  friend class CodeGen;

  NodeList::const_iterator GetChildrenBegin() const
  {
    return m_children.begin();
  }

  NodeList::const_iterator GetChildrenEnd() const
  {
    return m_children.end();
  }


protected:
  // This function is called recursively by Dump() to dump the entire contents
  // of the parse tree.  'indent' is the current indentation level.
  void Dump_Internal( int indent ) const;

  // Define the two data members for the parse tree:  The type and the set of
  // children for this node.
  PTNodeType m_type;
  NodeList m_children;
};



// The binary operator node is not used directly by the parser.  This class
// just defines some functions that are in common with all binary operators.
class BinOpNode : public PTNode {
public:
  BinOpNode( PTNodeType type, PTNodePtr lhs, PTNodePtr rhs )
    : PTNode( type )
  {
    Add( lhs );
    Add( rhs );
  }

  const PTNodePtr GetLHS() const                  { return m_children[0]; }
  const PTNodePtr GetRHS() const                  { return m_children[1]; }
};


class AddNode : public BinOpNode {
public:
  AddNode( PTNodePtr lhs, PTNodePtr rhs )
    : BinOpNode( Add_PTNodeType, lhs, rhs )
  {
  }

  virtual string GetName() const                  { return "Add"; }
};


class SubtractNode : public BinOpNode {
public:
  SubtractNode( PTNodePtr lhs, PTNodePtr rhs )
    : BinOpNode( Subtract_PTNodeType, lhs, rhs )
  {
  }

  virtual string GetName() const                  { return "Subtract"; }
};


class MultiplyNode : public BinOpNode {
public:
  MultiplyNode( PTNodePtr lhs, PTNodePtr rhs )
    : BinOpNode( Multiply_PTNodeType, lhs, rhs )
  {
  }

  virtual string GetName() const                  { return "Multiply"; }
};


class DivideNode : public BinOpNode {
public:
  DivideNode( PTNodePtr lhs, PTNodePtr rhs )
    : BinOpNode( Divide_PTNodeType, lhs, rhs )
  {
  }

  virtual string GetName() const                  { return "Divide"; }
};


class AssignmentNode : public BinOpNode {
public:
  AssignmentNode( PTNodePtr lhs, PTNodePtr rhs )
    : BinOpNode( Assignment_PTNodeType, lhs, rhs )
  {
  }

  virtual string GetName() const                  { return "Assignment"; }
};



// The constant node needs to also keep track of the constant that was
// specified in script.  This is done with the data member 'm_value'.
class ConstantNode : public PTNode {
public:
  ConstantNode( int value )
    : PTNode( Constant_PTNodeType ),
      m_value( value )
  {
  }

  int GetValue() const                            { return m_value; }

  virtual string GetName() const;


private:
  int m_value;
};


// The identifier node is used to signify where a variable is used.  The
// string name contained by this node isn't used anywhere except to print the
// name when the parse tree is dumped.  An identifier's offset will be
// initialized by the code generator.
class IdentifierNode : public PTNode {
public:
  IdentifierNode( string name )
    : PTNode( Identifier_PTNodeType ),
      m_name( name ),
      m_offset( 0 )
  {
  }


  void SetOffset( unsigned int offset )           { m_offset = offset; }
  unsigned int GetOffset() const                  { return m_offset;   }

  virtual string GetName() const;


private:
  unsigned int m_offset;
  string m_name;
};


class IfNode : public PTNode {
public:
  IfNode( PTNodePtr expr,
          PTNodePtr trueStmts,
          PTNodePtr falseStmts = NULL )
    : PTNode( If_PTNodeType )
  {
    Add( expr );
    Add( trueStmts );
    Add( falseStmts );
  }

  const PTNodePtr GetConditional() const          { return m_children[0]; }
  const PTNodePtr GetTrueStatements() const       { return m_children[1]; }
  const PTNodePtr GetFalseStatements() const      { return m_children[2]; }

  virtual string GetName() const                  { return "If"; }
};


class ForNode : public PTNode {
public:
  ForNode( PTNodePtr pre, PTNodePtr expr, PTNodePtr post, PTNodePtr body )
    : PTNode( For_PTNodeType )
  {
    Add( pre );
    Add( expr );
    Add( post );
    Add( body );
  }

  const PTNodePtr GetPreLoop() const              { return m_children[0]; }
  const PTNodePtr GetConditional() const          { return m_children[1]; }
  const PTNodePtr GetPostLoop() const             { return m_children[2]; }
  const PTNodePtr GetLoopBody() const             { return m_children[3]; }

  virtual string GetName() const                  { return "For"; }
};


class StatementNode : public PTNode {
public:
  StatementNode( PTNodePtr expr )
    : PTNode( Statement_PTNodeType )
  {
    Add( expr );
  }

  const PTNodePtr GetExpression() const           { return m_children[0]; }

  virtual string GetName() const                  { return "Statement"; }
};


class BlockNode : public PTNode {
public:
  BlockNode( PTNodePtr stmt )
    : PTNode( Block_PTNodeType )
  {
    Add( stmt );
  }

  virtual string GetName() const                  { return "Block"; }
};


#endif // __PTNode_H__

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
舔着乳尖日韩一区| 日韩欧美国产麻豆| 日本午夜精品视频在线观看| 欧美激情中文字幕一区二区| 欧美日韩国产123区| 成人午夜大片免费观看| 另类专区欧美蜜桃臀第一页| 亚洲在线观看免费视频| 在线观看一区不卡| 国内精品伊人久久久久影院对白| 一区二区在线看| 国产午夜精品美女毛片视频| 日韩一区二区三区电影| 欧美系列日韩一区| 91一区二区在线| 国产成人日日夜夜| 激情综合网激情| 日韩精品电影在线| 亚洲国产精品久久久久婷婷884| 中文字幕av一区 二区| 欧美精品一区二区三区视频| 欧美顶级少妇做爰| 欧美色视频在线观看| 色综合天天综合网国产成人综合天 | 亚洲综合一区二区三区| 国产欧美一区二区在线| 2023国产一二三区日本精品2022| 欧美精品丝袜久久久中文字幕| 欧美天堂一区二区三区| 色婷婷国产精品| 91日韩精品一区| 99久久久久久| 91网站最新网址| 91麻豆国产在线观看| av电影在线不卡| 成人精品视频一区二区三区| 成人网页在线观看| 成人美女视频在线看| 成人精品视频网站| 99久久伊人精品| 色老头久久综合| 日本亚洲欧美天堂免费| 国产亚洲午夜高清国产拍精品 | 成人精品国产福利| 成人免费毛片app| 成人高清免费在线播放| 99久久久国产精品| 在线观看一区二区视频| 欧美乱妇20p| 欧美肥妇毛茸茸| 精品免费日韩av| 国产午夜精品福利| 国产精品久久久久久久久图文区 | 日韩精品中午字幕| 久久久久9999亚洲精品| 国产精品美女久久久久高潮| 综合分类小说区另类春色亚洲小说欧美 | 舔着乳尖日韩一区| 美国精品在线观看| 国产精品 欧美精品| 波多野结衣欧美| 欧美午夜片在线观看| 欧美一区二区三区电影| 久久久久久电影| 日韩美女视频一区| 日本va欧美va瓶| 懂色中文一区二区在线播放| 色综合网色综合| 日韩免费一区二区三区在线播放| 国产无一区二区| 亚洲成av人片在线观看无码| 免费欧美在线视频| 成人精品视频一区二区三区 | 国产精品欧美一区二区三区| 一二三区精品福利视频| 久久国产视频网| av爱爱亚洲一区| 日韩欧美亚洲一区二区| 国产精品五月天| 婷婷久久综合九色国产成人| 懂色中文一区二区在线播放| 欧美福利一区二区| 国产精品日产欧美久久久久| 亚洲成a人v欧美综合天堂下载| 国产精品一二三四| 欧美特级限制片免费在线观看| 久久综合久久99| 亚洲综合色在线| 高清shemale亚洲人妖| 欧美日韩精品一区视频| 中文字幕一区二区三区av| 日韩电影在线免费| eeuss影院一区二区三区| 日韩欧美色综合| 夜夜嗨av一区二区三区| 国产福利一区二区三区视频在线| 欧美日韩一区二区欧美激情| 国产精品五月天| 国内精品视频一区二区三区八戒| 欧美丝袜自拍制服另类| 国产精品水嫩水嫩| 精品中文字幕一区二区小辣椒 | 欧美在线不卡一区| 中文字幕+乱码+中文字幕一区| 秋霞影院一区二区| 欧美色图一区二区三区| 中文字幕一区二区三区在线不卡 | 国产一区二区成人久久免费影院| 欧美日韩午夜影院| 亚洲人被黑人高潮完整版| 国产91在线|亚洲| 久久久久国产免费免费| 久久国产精品色婷婷| 91超碰这里只有精品国产| 亚洲影视在线观看| 91九色02白丝porn| 亚洲天堂免费在线观看视频| 成人免费看片app下载| 国产午夜亚洲精品午夜鲁丝片| 国内精品嫩模私拍在线| 日韩精品在线一区| 另类小说图片综合网| 日韩三级视频在线观看| 免费美女久久99| 日韩精品一区二区三区在线观看 | 毛片av中文字幕一区二区| 欧美日韩不卡在线| 亚洲高清视频在线| 欧美日韩极品在线观看一区| 亚洲国产综合91精品麻豆| 色av成人天堂桃色av| 一区二区三区精品在线观看| 色偷偷一区二区三区| 亚洲夂夂婷婷色拍ww47| 欧美日韩精品免费观看视频| 亚洲成人免费av| 欧美一区二区女人| 蜜桃久久久久久久| 26uuuu精品一区二区| 国产一区在线看| 国产精品久久久久久久裸模| 91毛片在线观看| 亚洲小说欧美激情另类| 欧美精品日韩综合在线| 蜜臀av亚洲一区中文字幕| 久久亚洲精精品中文字幕早川悠里| 激情文学综合插| 国产精品午夜在线| 在线免费精品视频| 天堂一区二区在线免费观看| 欧美一级一区二区| 国产一区二区h| 日韩伦理免费电影| 欧美久久久久免费| 久热成人在线视频| 国产精品午夜春色av| 在线视频你懂得一区| 欧美aaa在线| 国产欧美日韩不卡免费| 色一情一乱一乱一91av| 日韩成人免费电影| 久久久久久综合| 91片在线免费观看| 日本女人一区二区三区| 国产午夜一区二区三区| 91久久精品一区二区| 蜜桃视频在线一区| 中文字幕一区av| 欧美一区中文字幕| 成人高清免费在线播放| 亚洲v日本v欧美v久久精品| 2024国产精品| 欧美亚洲国产bt| 国产在线播放一区三区四| 亚洲视频每日更新| 精品久久人人做人人爽| 色综合久久综合网97色综合| 毛片一区二区三区| 亚洲精品久久久蜜桃| 精品少妇一区二区三区在线播放 | 中文字幕av一区二区三区高| 欧美日韩在线免费视频| 国产乱一区二区| 亚洲va国产va欧美va观看| 国产清纯白嫩初高生在线观看91 | 亚洲日本电影在线| 欧美精品一区二区三区一线天视频 | 韩国精品主播一区二区在线观看 | 五月婷婷色综合| 国产性做久久久久久| 51午夜精品国产| 97久久超碰精品国产| 九九**精品视频免费播放| 亚洲大型综合色站| 亚洲国产成人一区二区三区| 日韩视频一区二区三区在线播放| 91视频91自| 成av人片一区二区| 国产一区二区三区观看| 蜜桃视频免费观看一区|