# Invalid syntax in RELS lists with newest version of matrix code

**URL:** <https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596>\
**Category:** Grammar Matrix\
**Tags:** tdl\
**Created:** [November 25, 2020, 7:41pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596 "2020-11-25T19:41:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecconrad](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/839c29/32.png) [@ecconrad](https://delphinqa.ling.washington.edu/u/ecconrad)\
**Post date:** [November 25, 2020, 7:41pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/1 "2020-11-25T19:41:17Z")

</div>

I’m trying to use the newest version of the matrix code to create some grammars and then compile them and parse test profiles with ACE and ART. However I’m getting this error with ACE:

```
reading trigger-rule from `/overflow_projects/ecconrad/ecc-thesis/outputs/201125_1053/grammars/yaq/yaq1/ace/../trigger.mtr'
tdl: expected a dag definition
hint: structify -> rdagify failed
hint: structify -> rdagify failed
hint: listify failed
hint: structify -> rdagify failed
tdl: top-level error occured near /overflow_projects/ecconrad/ecc-thesis/outputs/201125_1053/grammars/yaq/yaq1/ace/../trigger.mtr:9

```

I then also get this error with ART (but my hope is this is just because ACE is failing to compile the grammar and fixing that will solve this also):

```
reading results for 0	out of sync; arbiter sent 'this does not appear to be a grammar image.' when expecting a SENT or SKIP header.
failed to read result for 0

```

I was not getting these errors when using an old version of the matrix code that was in python2, so I assume this is a bug with the matrix code, but based on this ACE error I’m not sure where to look in the matrix code to try to squash it.

---

<div class="post-metadata">

**Author:** ![ebender](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/34f0e0/32.png) [@ebender](https://delphinqa.ling.washington.edu/u/ebender)\
**Post date:** [November 25, 2020, 8:03pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/2 "2020-11-25T20:03:38Z")

</div>

As a quick work-around, since you aren’t using these grammars for generation, you can remove the contents of trigger.mtr (or maybe it’s called triggers.mtr).

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 25, 2020, 8:50pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/3 "2020-11-25T20:50:21Z")

</div>

Could you send me a choices file with which I could reproduce the problem?

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 25, 2020, 10:45pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/4 "2020-11-25T22:45:27Z")

</div>

Elizabeth has sent me a choices file and I performed the following tests on it:

1. Customize the grammar using the Matrix current trunk: Success
2. Load the grammar in the LKB: Fail.

 ![Screen Shot 2020-11-25 at 2.36.59 PM](https://delphinqa.ling.washington.edu/uploads/default/original/1X/45f1d5bd83d02b241ed1a0216d2be7d97215f9d1.png)

Seems like the same issue perhaps as ACE is having with the grammar.

line 7 is “cmpl”:

```auto
bwiika_3_gr := arg0e_gtr &
  [ CONTEXT.RELS.LIST < [ ARG0.E [ TENSE fut,
                                   ASPECT incep,
                                   cmpl ,
                                   pfv ] ] >,
    FLAGS.TRIGGER "bwiika_3" ].

```

There is an odd space before the comma but removing it does not help.

Maybe it is the multiple ASPECT values? @ebender, does this RELS list look OK to you?

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 25, 2020, 10:49pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/5 "2020-11-25T22:49:56Z")

</div>

Update: removing the multiple ASPECT values does help; there is no longer a failure associated with trigger.mrt. (Note that there are lots of errors associated with the lexicon file; those you also get with the old Matrix code. Do you know about them?)

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 25, 2020, 11:47pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/6 "2020-11-25T23:47:19Z")

</div>

I wonder if the bug has to do with this change that I had made: [Replacing RELS \<! with RELS.LIST \< : possible issues with TDL parser?](https://delphinqa.ling.washington.edu/t/replacing-rels-with-rels-list-possible-issues-with-tdl-parser/401/4)

---

<div class="post-metadata">

**Author:** ![sweaglesw](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/s/c67d28/32.png) [@sweaglesw](https://delphinqa.ling.washington.edu/u/sweaglesw)\
**Post date:** [November 26, 2020, 1:01am UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/7 "2020-11-26T01:01:37Z")

</div>

The syntax following ASPECT is invalid. Somehow you are specifying three comma separated values for ASPECT. TDL (and MTR rule) syntax is [ATTRIBUTE1 value1, ATTRIBUTE2 value2]. What was the expected result?

---

<div class="post-metadata">

**Author:** ![ebender](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/34f0e0/32.png) [@ebender](https://delphinqa.ling.washington.edu/u/ebender)\
**Post date:** [November 26, 2020, 1:16am UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/8 "2020-11-26T01:16:34Z")

</div>

This looks to me like the choices file did multi-select for the ASPECT value for that particular element. This should result in an underspecified supertype (disjunction of the specific types), but the code for generating the trigger rule isn’t getting that right. Not sure why this bug is showing up right now, but I guess it’s because AGG inference is serving as a stress-test 🙂

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 26, 2020, 1:26am UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/9 "2020-11-26T01:26:21Z")

</div>

I opened an issue: [https://github.com/delph-in/matrix/issues/543](https://github.com/delph-in/matrix/issues/543)

@ecconrad, is this a blocker for you?

---

<div class="post-metadata">

**Author:** ![ecconrad](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/839c29/32.png) [@ecconrad](https://delphinqa.ling.washington.edu/u/ecconrad)\
**Post date:** [November 26, 2020, 4:11am UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/10 "2020-11-26T04:11:07Z")

</div>

Removing the trigger info got me further, but now I am hitting some of those lexicon errors I believe:

```
UnicodeEncodeError: 'latin-1' codec can't encode character '\u0301' in position 2: ordinal not in range(256)
/overflow_projects/ecconrad/ecc-thesis/outputs/201125_1827/grammars/abz/abz4/ace/../roots.tdl: No such file or directory
1835 types (471 glb), 9 lexemes, 119 rules, 90 orules, 37 instances, 63 strings, 155 features
loaded grammar in 0.45017s
WARNING: not enough room in 128 bytes to record grammar information

```

The UnicodeEncodeError feels like an issue in the python, but the “not enough room” seems like either an ACE problem or an issue with the space in my directory. If it’s ACE I’m not sure how to go about fixing that

---

<div class="post-metadata">

**Author:** ![sweaglesw](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/s/c67d28/32.png) [@sweaglesw](https://delphinqa.ling.washington.edu/u/sweaglesw)\
**Post date:** [November 26, 2020, 4:42am UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/11 "2020-11-26T04:42:55Z")

</div>

I think the ACE error about recording grammar information can safely be ignored. It most likely means the pathname you used to indicate the grammar config location was longer than expected, or something similar.

I can’t speak to the Unicode error you are having.

---

<div class="post-metadata">

**Author:** ![ecconrad](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/839c29/32.png) [@ecconrad](https://delphinqa.ling.washington.edu/u/ecconrad)\
**Post date:** [November 26, 2020, 4:58am UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/12 "2020-11-26T04:58:11Z")

</div>

I found the source of this UnicodeEncode Error, this is in the `tdl.py` file in `matrix/gmcs`:

```
tdl_file = sys.stdout
tdl_indent = 0

def TDLwrite(s):
    global tdl_indent
    global tdl_file
    tdl_file.write(s) # <-- this line is failing
    i = s.rfind('\n')
    if i != -1:
        tdl_indent = len(s) - (i + 1)
    else:
        tdl_indent += len(s)

```

The issue is that it’s trying to write a non Unicode character to `tdl_file` which was set above to `sys.stdout` … and the terminal on patas is not set to use unicode apparently. I’m confused though because why would the tdl file be `stdout` and not `iso.tdl` ?

Regardless, I’ve at least pinpointed it to here.

UPDATE: … 😓found out I had commented out the lines in my `.bash_profile` that set the terminal to be Unicode … so I think it’s fixed.

---

<div class="post-metadata">

**Author:** ![ecconrad](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/839c29/32.png) [@ecconrad](https://delphinqa.ling.washington.edu/u/ecconrad)\
**Post date:** [November 26, 2020, 5:42pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/13 "2020-11-26T17:42:07Z")

</div>

I’ve hit the actual lexicon errors now, this is the error I’m seeing:

```
tdl: requested unification failed
hint: listify failed
hint: structify -> rdagify failed
hint: dagify failed
tdl: top-level error occured near /overflow_projects/ecconrad/ecc-thesis/outputs/201126_0922/grammars/abz/abz1/ace/../lexicon.tdl:2342

```

And I went to that spot in the lexicon and it was in this section:

```
;;; Case-marking adpositions

in-marker := case-marking-adp-lex &
  [ STEM < "mia" & "mi-ng" & "mi-a" >,
    SYNSEM.LOCAL [ CONT [ HOOK [ ICONS-KEY.IARG1 #clause,
                                 CLAUSE-KEY #clause ],
                          ICONS.LIST < > ],
                   CAT.HEAD [ CASE in,
                              CASE-MARKED + ] ] ]. 

on-marker := case-marking-adp-lex &
  [ STEM < "iti" & "taaha" >,
    SYNSEM.LOCAL [ CONT [ HOOK [ ICONS-KEY.IARG1 #clause,
                                 CLAUSE-KEY #clause ],
                          ICONS.LIST < > ],
                   CAT.HEAD [ CASE on,
                              CASE-MARKED + ] ] ].

loc-marker := case-marking-adp-lex &
  [ STEM < "he-laak" >,
    SYNSEM.LOCAL [ CONT [ HOOK [ ICONS-KEY.IARG1 #clause,
                                 CLAUSE-KEY #clause ],
                          ICONS.LIST < > ],
                   CAT.HEAD [ CASE loc,
                              CASE-MARKED + ] ] ].

```

Specifically the error marked the last line of the definition of ‘in-marker’. Are there any syntax errors that stand out?

---

<div class="post-metadata">

**Author:** ![ebender](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/34f0e0/32.png) [@ebender](https://delphinqa.ling.washington.edu/u/ebender)\
**Post date:** [November 30, 2020, 4:35pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/14 "2020-11-30T16:35:06Z")

</div>

Yep! The problem is in the STEM definition:

STEM \< “mia” & “mi-ng” & “mi-a” \>,

Each lexical entry can have only one STEM value. So it looks like you want to be generating three different lexical entries with [CASE in].

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 30, 2020, 5:08pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/15 "2020-11-30T17:08:19Z")

</div>

To go back to the bug with the syntax of the RELS list; how urgent it is to fix? That could well be my responsibility (unlike the lexicon). Is this something you need to do many times (create these grammars)?

---

<div class="post-metadata">

**Author:** ![ecconrad](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/839c29/32.png) [@ecconrad](https://delphinqa.ling.washington.edu/u/ecconrad)\
**Post date:** [November 30, 2020, 9:37pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/16 "2020-11-30T21:37:53Z")

</div>

I do create the grammars every time I run my system, but the fix Emily provided of emptying out the trigger.mtr file allowed me to progress past that. So for now after the grammars are created, I just use a shell command to clear out that file since I don’t use them for what I’m doing. So it’s not blocking me personally.

---

<div class="post-metadata">

**Author:** ![adods](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adods](https://delphinqa.ling.washington.edu/u/adods)\
**Post date:** [July 11, 2021, 12:26am UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/17 "2021-07-11T00:26:04Z")

</div>

@ecconrad I’m also hitting the UnicodeEncodeError. ☹ Would you mind letting me know what you specifically had in your .bash\_profile that fixed it?

---

<div class="post-metadata">

**Author:** ![adods](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adods](https://delphinqa.ling.washington.edu/u/adods)\
**Post date:** [July 12, 2021, 12:16am UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/18 "2021-07-12T00:16:11Z")

</div>

(Never mind, got it to work with:  
export LC\_ALL=en\_US.UTF-8  
export LANG=en\_US.UTF-8  
export LANGUAGE=en\_US.UTF-8)

---

<div class="post-metadata">

**Author:** ![ecconrad](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/839c29/32.png) [@ecconrad](https://delphinqa.ling.washington.edu/u/ecconrad)\
**Post date:** [July 12, 2021, 4:56pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/19 "2021-07-12T16:56:42Z")

</div>

Sorry for getting to this late! But that’s exactly what I have in mine 🙂 I should be sure to add a note about this to my startup README though… thanks for reminding me about this issue!

---

<div class="post-metadata">

**Author:** ![adods](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adods](https://delphinqa.ling.washington.edu/u/adods)\
**Post date:** [July 12, 2021, 5:53pm UTC](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596/20 "2021-07-12T17:53:53Z")

</div>

I don’t think it was late at all, and it was the weekend to boot! 🙂 I’d just commented as reference for future readers.

But yeah, that’s a great idea!

[Next page](https://delphinqa.ling.washington.edu/t/invalid-syntax-in-rels-lists-with-newest-version-of-matrix-code/596.md?page=2)
