Beispiel #1
0
        private int HandleAbbrevOrDef(OuterDecl d, string topLevel, TypeIsa type, string equality,
                                      Tuple <IList <Term>, Term> equation)
        {
            _sb.Append(topLevel + " ").Append(d.Name);
            if (type != null)
            {
                _sb.Append(" :: ");
                AppendInner(_typeIsaPrinter.Visit(type));
            }

            _sb.AppendLine().Append(IsaPrettyPrinterHelper.Indent(1)).Append("where");
            _sb.AppendLine().Append(IsaPrettyPrinterHelper.Indent(2));

            var args = _termPrinter.VisitList(equation.Item1).SpaceAggregate();

            AppendInner(
                () => _sb.Append(d.Name).Append(" ").Append(args).Append(" " + equality + " ")
                .Append(_termPrinter.Visit(equation.Item2))
                );

            return(0);
        }
Beispiel #2
0
        public override int VisitFunDecl(FunDecl d)
        {
            _sb.Append("fun ");
            _sb.Append(d.Name);
            if (d.Type != null)
            {
                _sb.Append(" :: ");
                AppendInner(_typeIsaPrinter.Visit(d.Type));
            }

            _sb.AppendLine().Append(IsaPrettyPrinterHelper.Indent(1)).Append("where");

            var first = true;

            foreach (var tuple in d.Equations)
            {
                _sb.AppendLine().Append(IsaPrettyPrinterHelper.Indent(2));

                if (first)
                {
                    first = !first;
                }
                else
                {
                    _sb.Append("|");
                }

                var args = _termPrinter.VisitList(tuple.Item1).SpaceAggregate();

                AppendInner(() =>
                            _sb.Append(d.Name).Append(" ").Append(args).Append(" = ").Append(_termPrinter.Visit(tuple.Item2))
                            );
            }

            return(0);
        }