Feature Logics

Originally published on Wed, 05/08/2013 - 06:41

ATDL Main Constructors

type-def -> type { avm-def } '.'                                             

note that default avm-def is *top*

type -> IDENTIFIER

rule -> rulename { ":>" | ":/" } regexp "->" avm-def [function] "."            

note that ":/" is for no output

rulename -> IDENTIFIER

regexp ->

    [~] avm |

    "@@(" rulename ")" |            % apply (recurse)

    "(" regexp ")" |

    regexp {regexp}+ |

    regexp {"|" | ";"} {regexp}+ |

    regexp {"+" | "*" | "?" | "{" INT [ "," INT ] "}"

function -> ", call" predicate {"," predicate}+

predicate -> Prolog predicate with arguments that are ground terms, corefs, and setrefs

Type and Instance Definitions

avm-def -> ':=' conjunction

conjunction -> term | term '&' conjunction

term -> type | STRING | feature-term | coref | setref

feature-term -> '[' [attr-val-list] ']'

attr-val-list -> attr-val [',' attr-val-list]

attr-val -> attr-list conjunction

attr-list -> attribute ['.' attr-list]

attribute -> IDENTIFIER

coref -> '#' IDENTIFIER

setref -> '%' IDENTIFIER

instance-def -> instance avm-def

instance -> IDENTIFIER

STRING            % single line double-quoted STRINGs (numbers must be also double quoted)

IDENTIFIER        % unquoted alphanumeric string, not any of the built-in tokens.

INT                % integer used in regexp

Lists and Difference Lists

There is some syntactic sugar to ease the notation of lists and difference lists.

The underlying definitions that correspond to the list and difference list sugars are:

*list* := *top*.

*ne-list* := *list* & [ FIRST *top*, REST *list* ].

*null* := *list*.

Parameterized list types ('list of X') are defined thus:

*s-list* := *list*.

*s-ne-list* := *ne-list* & *s-list* & [ FIRST expression, REST *s-list* ].

*s-null* := *null* & *s-list*.

In TDL we have the sugar as, for example:

< > == *null*                                             ( empty list )

< a, b > == [ FIRST a, REST [ FIRST b, REST *null* ] ]    ( simple list of exactly 2 elements )

< a, ... > == [ FIRST a, REST *list* ]                    ( variable
length list with at least 1 element )

<! a !> == [ LIST [ FIRST a, REST #tail ], LAST #tail ]   ( difference list with one element )

<! !> == [ LIST #list, LAST #list ]                       ( empty difference list )

Further, there is a sugar for appending lists:

< a, b . c > == [ FIRST a, REST [ FIRST b, REST c ] ]     ( and so on for different list lengths )

The BNF provided by Callmeier is:

term -> list | diff-list

diff-list -> '<!' [conjunction-list] '!>'

conjunction-list -> conjunction [',' conjunction-list]

list -> '<' conjunction-list '>' |

        '<' conjunction-list ', ...' '>'  |

        '<' conjunction-list '.' conjunction '>'

Note that type definitions for types that are also Prolog operators may need extra parentheses on the LHS.

(+) := .....

At present, the only operators that cause problems are unary +, =, not, and case.

what attributes are in each partition (and where are they used?)

what paths are in each partition (and where are they used?)

=== Are any partitions classed as sorts but actually avms? (and perhaps vice versa)

For each path, what are the constraining types?

Are all of these in the same partition?

Are any of these top, avm or sort?

Are there any paths that have no constraining types?