tclbdd

Check-in [f935c63420]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:more compiler development, most of the way through doing intermediate code for rules
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f935c63420050148f3f5279b2045b0904be50893
User & Date: kbk 2014-01-08 03:47:58
Context
2014-01-08
04:57
more compiler development, most of the way through doing intermediate code for rules check-in: e19d9e2146 user: kbk tags: trunk
03:47
more compiler development, most of the way through doing intermediate code for rules check-in: f935c63420 user: kbk tags: trunk
03:10
more compiler development, most of the way through doing intermediate code for rules check-in: 824a0d10b3 user: kbk tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to library/datalog.tcl.

962
963
964
965
966
967
968
969



































970

971
972
973
974
975
976
977
978
	    lappend intcode [list RELATION $resultRelation $resultColumns]
	    lappend intcode [list $operation $resultRelation \
				 $dataSoFar $dataThisOp]
	}
	return [list $resultRelation $resultColumns]
    }

    method translateRuleHead {db headLiteral sourceRelation sourceColumns} {



































	# TODO: Destub

	lappend intcode [list IDONTKNOW UNIONTO [lindex $headLiteral 1] $sourceRelation]
	
    }

    method getRule {ruleNo} {
	return [lindex $rules $ruleNo]
    }








|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
|







962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
	    lappend intcode [list RELATION $resultRelation $resultColumns]
	    lappend intcode [list $operation $resultRelation \
				 $dataSoFar $dataThisOp]
	}
	return [list $resultRelation $resultColumns]
    }

    method translateRuleHead {db literal sourceRelation sourceColumns} {
	set predicate [lindex $literal 1]
	db relationMustExist $predicate
	set cols [db columns $predicate]
	if {[llength $cols] != [llength $literal]-2} {
	    set pplit [bdd::datalog::prettyprint-literal $literal]
	    return -code error \
		-errorCode [list DATALOG wrongColumns $predicate $pplit] \
		"$predicate has a different number of columns from $pplit"
	}
	set destColumns [lrange $literal 2 end]

	# Project away unused columns in sourceColumns.
	# Warn about columns in literal that are not in sourceColumns.
	# Rename columns from literal to destination.
	# Join with any don't-cares

	set needProject 0
	set projector [my gensym #T]
	set projectColumns {}
	puts "Project $sourceColumns into $destColumns"
	foreach col $sourceColumns {
	    if {[lsearch -exact $destColumns $col] >= 0} {
		lappend projectColumns {}
	    } else {
		set needProject 1
	    }
	}
	if {$needProject} {
	    lappend intcode [list RELATION $projector $projectColumns]
	    lappend intcode [list PROJECT $projector $sourceRelation]
	    set renameSource $projector
	} else {
	    set renameSource $sourceRelation
	}

	# TODO: Destub

	lappend intcode [list IDONTKNOW UNIONTO [lindex $literal 1] $sourceRelation]
	
    }

    method getRule {ruleNo} {
	return [lindex $rules $ruleNo]
    }