Esempio n. 1
0
SDF_ProductionList SDF_concatProductionList(SDF_ProductionList l1,
                                            SDF_ProductionList l2)
{
  if (!SDF_isProductionListEmpty(l2)) {
    if (SDF_hasProductionListHead(l1)) {
      SDF_Production head = SDF_getProductionListHead(l1);
      if (SDF_hasProductionListTail(l1)) {
        SDF_ProductionList tail = SDF_getProductionListTail(l1);

        return SDF_makeProductionListMany(head, 
                 SDF_makeLayoutEmpty(),
                 SDF_concatProductionList(tail, l2));
      }
      else {
        return SDF_makeProductionListMany(head, 
                 SDF_makeLayoutEmpty(), l2);
      }
    }
    else {
      return l2;
    }
  }          

  return l1;
}
Esempio n. 2
0
static void createMappingToPT(SDF_ProductionList productions)
{
  mapping = ATtableCreate(1024, 75);

  while (SDF_hasProductionListHead(productions)) {
    SDF_Production prod = SDF_getProductionListHead(productions);

    if (SDF_isProductionProd(prod)) {
      PT_Production ptprod = SDFProductionToPtProduction(prod);

      if (ptprod) {
	ATtablePut(mapping, (ATerm) normalizeProduction(ptprod), (ATerm) prod);
      }
    }

    if (!SDF_hasProductionListTail(productions)) {
      break;
    }
    else {
      productions = SDF_getProductionListTail(productions);
    }
  }
}