Пример #1
0
        public Bound_Expression_Node Bind_Expression(Expression_Syntax_Node expression_syntax)
        {
            switch (expression_syntax.Kind_Of_Token)
            {
            case Syntax_Kind_of_Token.Parenthesized_Expression:
                return(Bind_Parenthesized_Expression((Parenthesized_Expression_Syntax_Node)expression_syntax));

            case Syntax_Kind_of_Token.Literal_Expression:
                return(Bind_Literal_Expression((Literal_Expression_Syntax_Node)expression_syntax));

            case Syntax_Kind_of_Token.Name_Expression:
                return(Bind_Name_Expression((Name_Expression_Syntax_Node)expression_syntax));

            case Syntax_Kind_of_Token.Assignment_Expression:
                return(Bind_Assignment_Expression((Assignment_Expression_Syntax_Node)expression_syntax));

            case Syntax_Kind_of_Token.Unary_Expression:
                return(Bind_Unary_Expression((Unary_Expression_Syntax_Node)expression_syntax));

            case Syntax_Kind_of_Token.Binary_Expression:
                return(Bind_Binary_Expression((Binary_Expression_Syntax_Node)expression_syntax));

            default:
                throw new Exception($"Unexpected Syntax {expression_syntax.Kind_Of_Token}");
            }
        }
Пример #2
0
 public Assignment_Expression_Syntax_Node(Syntax_Tokens_Set identifier_token, Syntax_Tokens_Set equals_token, Expression_Syntax_Node expression)
 {
     Identifier_Token = identifier_token;
     Equals_Token     = equals_token;
     Expression       = expression;
 }
Пример #3
0
 public Parenthesized_Expression_Syntax_Node(Syntax_Tokens_Set open_parenthesis_token, Expression_Syntax_Node expression, Syntax_Tokens_Set closed_parenthesis_token)
 {
     Open_Parenthesis_Token   = open_parenthesis_token;
     Expression               = expression;
     Closed_Parenthesis_Token = closed_parenthesis_token;
 }
 public Binary_Expression_Syntax_Node(Expression_Syntax_Node left_token, Syntax_Tokens_Set operator_token, Expression_Syntax_Node right_token)
 {
     Left_Token     = left_token;
     Operator_Token = operator_token;
     Right_Token    = right_token;
 }
Пример #5
0
 public Syntax_Tree(IEnumerable <string> diagnostics, Expression_Syntax_Node root_node, Syntax_Tokens_Set end_of_file_object)
 {
     Diagnostics        = diagnostics.ToArray();
     Root_Node          = root_node;
     End_Of_File_Object = end_of_file_object;
 }
 public Unary_Expression_Syntax_Node(Syntax_Tokens_Set operator_token, Expression_Syntax_Node operand_token)
 {
     Operator_Token = operator_token;
     Operand_token  = operand_token;
 }