Example #1
0
int
main() {
  Lexp l;
  int i;

  setvbuf(stdout, NULL, _IONBF, 0);
  initpool();

  for (i = 0; i < sizeof(testcases)/sizeof(testcases[0]); i++) {
    l = Lstr2Lexp(testcases[i]);
    printf("*** Doing dfs on "); printlexp(l);
    dfsLexp(l, func);
  }
  return 0;
}
Example #2
0
int
main() {
  Lexp c1, c2, c3, c4, c5;
  int i;
  char buf[1024];

  setvbuf(stdout, NULL, _IONBF, 0);

  initpool();

  c1 = Lstr2Lexp("(L 1.(L 2.(2 1)))");
  c2 = Lstr2Lexp("(L 1.(L 2.1))");
  c3 = Lstr2Lexp("(L 1.(L 2.2))");
  c4 = Lappl(c1, c2);
  c5 = Lappl(c4, c3);
  printlexp(c5);
  
  i = nbeta(c5, CANONICAL, 10);
  LLexp2str(c5, buf, sizeof(buf));
  printf(" -> reduced to %s in %d times\n", buf, i);

  c1 = Lnewvar(1L);
  c2 = Lnewvar(2L);
  c3 = Lappl(c1, c2);
  c4 = Labst(1L, c3);
  c5 = Labst(2L, c4);
  printf("first: ");
  printlexp(c5);

  c1 = Lstr2Lexp("(4 (5 6))");
  c2 = Lappl(c5, c1);
  printf("next: ");
  printlexp(c2);

  c3 = Lstr2Lexp("(L 7.(7 7))");
  c4 = Lappl(c2, c3);
  printf("last: ");
  printlexp(c4);

  i = nbeta(c4, CANONICAL, 20);
  LLexp2str(c4, buf, sizeof(buf));
  printf(" -> reduced to %s in %d times\n", buf, i);

  return 0;
}
Example #3
0
int
main() {
  Lexp l1, l2;
  int i, dif;

  setvbuf(stdout, NULL, _IONBF, 0);
  initpool();

  for (i = 0; i < sizeof(testcases)/sizeof(testcases[0]); i++) {
    l1 = Lstr2Lexp(testcases[i][0]);
    l2 = Lstr2Lexp(testcases[i][1]);
    printlexp(l1);
    printlexp(l2);
    dif = diff(l1, l2);
    printf("diff = %d\n", dif);
  }
  return 0;
}
Example #4
0
int
main() {
  Lexp l;
  int i;

  initpool();

  for (i = 0; i < sizeof(testcases)/sizeof(testcases[0]); i++) {
    printf("%s\n", testcases[i]);
    l = str2lexp(testcases[i]);
    while (betastep(l, CANONICAL)) {
      printf(" -> ");
      printlexp(l);
    }
    printf("done.\n");
  }
  return 0;
}
Example #5
0
void
initialize(void)
{
	engine_initialize();

	initvmstat();
	initpigs();
	initifstat();
	initiostat();
	initsensors();
	initmembufs();
	initnetstat();
	initswap();
	initpftop();
	initpf();
	initpool();
	initmalloc();
	initnfs();
}
Example #6
0
int
main() {
  char **p;
  Lexp l, newl;

  initpool();

  for (p = testcases; *p != NULL; p++) {
    printf("Lambda expression string \"%s\" -> ", *p);
    l = str2lexp(*p);
    printlexp(l);
    newl = deepcopy(l);
    printf("Original Lexp: ");
    printlexp(l);
    printf("Copied Lexp: ");
    printlexp(newl);
  }

  return 0;
}
Example #7
0
int
main() {
  Lexp c;
  int i;
  char buf[1024];
  int nc;

  if (setvbuf(stdout, NULL, _IONBF, 0) == EOF)
    fprintf(stderr, "*** setvbuf failed ***\n");

  initpool();

  for (i = 0; i < sizeof(testcases)/sizeof(testcases[0]); i++) {
    printf("%s ***\n", testcases[i]);
    c = str2lexp(testcases[i]);
    printf("  printlexp: ");
    printlexp(c);
    nc = lexp2str(c, buf, sizeof(buf));
    printf("  lexp2str:  ");
    printf("%s (code %d)\n", buf, nc);
  }
  return 0;
}