示例#1
0
        /// <summary>
        /// Parser for Formal
        /// </summary>
        /// <returns>Parsed Formal</returns>
        public Formal ParseFormal()
        {
            Formal formal = new Formal();

            CurrentToken = TokenStream.NextToken();
            formal.SetIdentifier(CurrentToken.GetValue().ToString());

            return formal;
        }
示例#2
0
        /// <summary>
        /// Visit FuncBindAssignment
        /// </summary>
        /// <param name="assignment">FuncBindAssignment to check</param>
        public override void Visit(FuncBindAssignment assignment)
        {
            //FuncBind is a function, so let checking do by FunctionDefinition visitor
            FunctionDefinition function = new FunctionDefinition();
            function.SetIdentifier(assignment.GetIdentifier());

            foreach (String identifier in assignment.GetIdentifiers())
            {
                Formal formal = new Formal();
                formal.SetIdentifier(identifier);
                function.AddFormal(formal);
            }

            function.AddStatement(assignment.GetStatement());

            //Check this new function
            function.AcceptVisitor(this);
            //Add to SymbolTable
            SymbolTable.AddFunctionDefinition(function);
        }