PreviousUpNext

15.4.603  src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax-junk.pkg

## deep-syntax-junk.pkg
## (C) 2001 Lucent Technologies, Bell Labs

# Compiled by:
#     src/lib/compiler/front/typer-stuff/typecheckdata.sublib



# More stuff from typer_junk should be moved here eventually.

stipulate
    package ds  =  deep_syntax;                                                                 # deep_syntax           is from   src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.pkg
    package tup =  tuples;                                                                      # tuples                is from   src/lib/compiler/front/typer-stuff/types/tuples.pkg
    package ty  =  types;                                                                       # types                 is from   src/lib/compiler/front/typer-stuff/types/types.pkg
herein

    package deep_syntax_junk
    : (weak)  api {

        void_expression:  ds::Deep_Expression;

        tupleexp:  List( ds::Deep_Expression ) -> ds::Deep_Expression;
        tuplepat:  List( ds::Case_Pattern    ) -> ds::Case_Pattern;

    }
    {
        void_expression = ds::RECORD_IN_EXPRESSION [];

        fun tupleexp l
            =
            ds::RECORD_IN_EXPRESSION (build (1, l))
            where
                fun build (_, [])
                        =>
                        [];

                    build (i, e ! es)
                        =>
                        ( ds::NUMBERED_LABEL { number => i - 1,
                                               name   => tup::number_to_label i
                                             },
                          e
                        )
                        !
                        build (i+1, es);
                end;
            end;

        fun tuplepat l
            =
            ds::RECORD_PATTERN { fields        => build (1, l),
                                 is_incomplete => FALSE,
                                 type_ref      => REF ty::UNDEFINED_TYPE
                               }
            where
                fun build (_, [])     =>  [];
                    build (i, e ! es) =>  (tup::number_to_label i, e) ! build (i+1, es);
                end;

            end;
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext