Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/charisee/src/compiler/einTest/testNormalize.sml
ViewVC logotype

View of /branches/charisee/src/compiler/einTest/testNormalize.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2497 - (download) (annotate)
Wed Oct 30 17:29:20 2013 UTC (5 years, 11 months ago) by cchiw
File size: 1959 byte(s)
 
(*Test transform function*)
structure  tNormalize = struct

    local
    structure E = Ein
    structure P= Printer
	structure N = NormalizeEin
    structure X =ExamplesN
    structure XS =ExamplesS

    in


val x=[]


val line="\n ------------------ "

fun test(e)= let val n=N.normalize(e)
in (print line;print(P.printerE(e)); print "=>";print( P.printerE(n)); print line;n)
    end


fun create(b)= E.EIN{params=[], index=[], body=b}

fun tester(e)=  List.map (fn(e1)=>test(create e1)) e




(*Test einexp *)
fun run (set)=
    let
    val base=[]

    val r1=[X.probe1,X.probe2,X.probe3,X.probe4,X.probe5,X.probe6,X.probe7]
    val r2=[X.probe8,X.probe9,X.probe10,X.probe11,X.probe12,X.probe13]
    val r3=[X.sum1,X.sum2,X.sum3,X.sum4,X.sum5,X.sum6]
    val r4=[X.sum7,X.sum8,X.sum9,X.sum10,X.sum11,X.sum12,X.sum13,X.sum14]
    val r5=[X.sum15,X.sum16,X.sum17,X.sum18,X.sum19,X.sum20,X.sum21,X.sum22,X.sum23]
    val r6=[X.sum24,X.sum25,X.sum26,X.sum27,X.sum28]
    val r7=[X.prod1,X.prod2,X.prod3,X.prod4,X.prod5]
    val r8=[X.prod6,X.prod7,X.prod8,X.prod9,X.prod10]
    val r9=[X.apply1,X.apply2,X.apply3,X.apply4,X.apply5,X.apply6]
    val r10=[X.apply7,X.apply8,X.apply9,X.apply10,X.apply11,X.apply12]
    val r11=[X.apply13,X.apply14,X.apply15,X.apply16,X.apply17,X.apply18]
    val r12=[X.applysum1,X.applysum2,X.applysum3,X.applysum4,X.applysum5,X.applysum6,X.applysum7]

    val r=   if(set=1) then tester r1
        else if(set=2) then tester r2
        else if(set=3) then tester r3
        else if(set=4) then tester r4
        else if(set=5) then tester r5
        else if(set=6) then tester r6
        else if(set=7) then tester r7
        else if(set=8) then tester r8
        else if(set=9) then tester r9
        else if(set=10) then tester r10
        else if(set=11) then tester r11
        else if(set=12) then tester r12
        else  base
    in
        r
    end


val r1=List.map run x



  end; (* local *)

    end (* local *)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0