voda@ubc-cs (Paul Voda) (03/24/88)
In article <794@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes: >In article <1897@ubc-cs.UUCP>, voda@ubc-cs (Paul Voda) writes: >{ criticising Prolog } >> ... > >{ praising Trilogy } >> Trilogy is careful to preserve the logic in similar situation by copying out the >> value of y into the variable x. ^^^^^^^ > >When does Trilogy require copying? Does it use reference counting, >as SETL used to, or is it a compile time analysis? Typical O'Keefe he cannot resist inserting the cute remarks in the brackets! Here is the answer formulated in a slightly more general setting: The modes and types of Trilogy permit the native code compilation of programs in such a way that there are no run-time tags on most of the values, neither there are any reference counters. The decision when to copy out and when to share the values of input-output variables is done by a compile time data-flow analysis. Similarly, the compiler of Trilogy checks whether the output variables are assigned values in all branches of a predicate (whether all input-output variables are initialized). There is also a check to see that if-then-elses do not backtrack (either before thens or among the branches), e.g. if x = 1 | x = 2 then x <> 1 & P(x) else ...... end The above is dissalowed by the compiler if x is output or symbolic (logical), but is OK if x is input or input/output. Thus we can guarantee that the negation of the formula before a then is always properly computable. Consequently if-then-elses and the formulas before thens are compiled without any settings of choice points. We are just releasing a version where non-backtracking ors (|) (implemented by jumps instead of choice points) are permitted in procedures (this is useful for the writing of the Trilogy counterparts of Pascal's boolean functions). There are two situations where the run-time tags on Trilogy values are present: 1) the tags discriminating the union values, these should be also present in Pascal programs. For instance, the universal type U of all Trilogy's values has a form of a union: U = R(R) | S(S) | P(U,U) The tags R(eal), S(tring), and P(air) are thus present in the values of U variables. If a value is not of a union type (tuple, list, array, integer, enumerated-type etc.) then it contains no tags, except of course the tags of any of its union constituents. 2) When a variable is of symbolic (logical) mode then Trilogy uses the type specific tags to identify the constraints attached to the variable (=, <, <>, etc.). Because of the typing, modes, pred/proc modifiers and a quite extensive data-flow analysis the compiler of Trilogy produces a procedural code of Pascal-like quality while offering all the high-level comfort of symbolic values with their associated constructors and destructors as we know it from Prolog.
ok@quintus.UUCP (Richard A. O'Keefe) (03/24/88)
In article <1901@ubc-cs.UUCP>, voda@ubc-cs (Paul Voda) writes: > In article <794@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes: > >In article <1897@ubc-cs.UUCP>, voda@ubc-cs (Paul Voda) writes: > >{ criticising Prolog } > >> ... > >{ praising Trilogy } > Typical O'Keefe he cannot resist inserting the cute remarks in the brackets! Don't see slights where none are intended. The {notes} were not and are not "cute remarks", they are synopses of a lot of material that I didn't quote. Should Prolog not be criticised? Of course not! Should Trilogy not be praised? Of course not! Were the {notes} fair summaries? Too right they were. > Here is the answer formulated in a slightly more general setting: Thank you. To change the subject a wee bit, what information is available about the ideas behind Trilogy? Any UCB reports?