UoYCS-plasma/GP2

Compiler produces code that won't compile

GrahamCampbell opened this issue · 6 comments

Input:

Main = rule

rule()
[ | ] => [ (n0, empty # green) | ]
interface = {}

Output:

Main_rule.c: In function 'applyMain_rule':

Main_rule.c:10:37: error: 'morphism' undeclared (first use in this function); did you mean 'Morphism'?

int host_edge_index = lookupEdge(morphism, 0);

^~~~~~~~

Morphism

Main_rule.c:10:37: note: each undeclared identifier is reported only once for each function it appears in

Main_rule.c:10:8: warning: unused variable 'host_edge_index' [-Wunused-variable]

int host_edge_index = lookupEdge(morphism, 0);

^~~~~~~~~~~~~~~

make: *** [Main_rule.o] Error 1

I haven't found a fix yet but it seems to be generated here:

genRule.c 788-800

      if(node->label.mark == NONE && node->label.length == 0)
      {
         if(!blank_label)
         {
            PTFI("label = blank_label;\n", 3);
            blank_label = true;
         }
      }
      else
      {
         PTFI("int host_edge_index = lookupEdge(morphism, %d);\n", 3, index);
         generateLabelEvaluationCode(node->label, true, index, 0, 3);
      }

I don't currently know why a lookupEdge is being called here... I'll see if I can work it out.

Yep, that looks about right. Should be an easy fix. I can do it once I'm back in the country.

✈️

Fixed.