Handling Common Errors
Table of Contents
Open Table of Contents
Undefined Type Error
Error:
! undef_type(xxx)
This error indicates that the type xxx
is not defined in your grammar. It occurs when you reference a type that has not been introduced in the grammar’s hierarchy.
Solution:
- Check the spelling of your type’s feature structure.
- Ensure that the type
xxx
is declared correctly in the grammar.
Unsatisfiable Lexical Entry
Error:
{ALE: ERROR: lex: unsatisfiable lexical entry for i
This error is caused by a lexical entry that cannot be satisfied. For example, the following definition of i
will generate this error, as subjective
is not a valid type of sem
:
i ---> (np, sem:subjective, agr:(person:first, case:subjective)).
Solution:
- Ensure that the type assignment in your lexical entry is correct and conforms to the expected type hierarchy. In the example above, the type
subjective
should be corrected or changed to match the valid types forsem
.
Appending to an Uninitialized List (TRALE Will Hang)
When appending to an uninitialized list, TRALE can enter an infinite loop. For example:
Problematic Code:
bot sub [cat, list].
cat sub [a,b,c] intro [list:list].
list sub [e_list, ne_list].
ne_list intro [hd:bot, tl:list].
a ---> a.
b ---> b.
append([], Xs, Xs) if true.
append([H|T1], L2, [H|T2]) if append(T1, L2, T2).
this_will_hang rule
(c, list:Result) ===>
cat> (a, list:List),
cat> (b, B),
goal> append(List, [B], Result).
This code results in an infinite loop because List
is uninitialized. When appending to an uninitialized list, TRALE cannot determine the base case and continues to append indefinitely.
Symptom:
When running this code, you may encounter an unresponsive system, and TRALE will appear to hang:
| ?- rec[a,b].
STRING:
0 a 1 b 2
^Ctrale interruption (h for help)? a
Solution:
You can interrupt the program with Ctrl + C
, then enter a
to abort.
To avoid this issue, initialize the list properly:
-
Initialize in the lexical entry:
a ---> (a, list:[]).
-
Initialize in the rule:
cat> (a, list:(List, [])),
This ensures the list has a starting value, and the append operation can complete properly.
Duplicate Feature Names in Type Hierarchies
Error:
! ale(feat_intro(...))
This error occurs when you define duplicated feature names in types that do not inherit from each other. For example:
Problematic Code:
a sub [b, c, f].
b intro [f:f].
c intro [f:f].
In this case, both b
and c
introduce a feature f
, but they do not inherit from each other, causing a conflict.
Solution:
You have two options to resolve this issue:
-
Rename one of the features to avoid duplication, ensuring unique feature names.
-
Group the types into a common supertype to allow shared feature introduction. For example:
a sub [b_c, f]. b_c sub [b, c] intro [f: f].
By grouping
b
andc
under the supertypeb_c
, you can introduce the featuref
once at the shared level.
This refined tutorial offers clarity on some of the most common TRALE programming errors and provides actionable solutions to help you avoid or fix these issues.