public static TrsProgramBlock Convert(this AstProgramBlock astIn)
        {
            var trsProgramBlock = new TrsProgramBlock(astIn);

            foreach (var statement in astIn.Statements)
            {
                if (statement is AstTermBase)
                {
                    trsProgramBlock.Statements.Add(ConvertAstTermBase((AstTermBase)statement));
                }
                else if (statement is AstReductionRule)
                {
                    trsProgramBlock.Statements.Add(((AstReductionRule)statement).Convert());
                }
                else if (statement is AstTypeDefinitionStatement)
                {
                    trsProgramBlock.Statements.Add(((AstTypeDefinitionStatement)statement).Convert());
                }
                else if (statement is AstLimitStatement)
                {
                    trsProgramBlock.Statements.Add(((AstLimitStatement)statement).Convert());
                }
                else
                {
                    throw new ArgumentException("Enexpected AST type: " + statement.GetType().FullName);
                }
            }
            return(trsProgramBlock);
        }
Esempio n. 2
0
 public TrsProgramBlock(AstProgramBlock astSource) : this()
 {
     AstSource = astSource;
 }