|
From: Andreas L. <and...@st...> - 2007-12-04 08:16:48
|
Hi all,
one major problem with reuseware I experience is, that identical
grammars don't necessarily lead to identical results. This problem
occurs in two variations:
1. If generating a text parser from a concrete grammar results in an
error, it often helps to delete the created folder and just try again.
2. More severe: If the text parser(s) is (are) generated, but reuseware
can't parse some code, this is not necesarily due to wrong grammars.
Often redoing all the steps (map to ecore, generate language plugin,
generate text parser) without changing the grammars at all helps.
As an example I attach grammars for a subset (!!!) of C. With these
grammars reuseware understands this program (this is not meant to be a
good parallelization....):
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#define LENGTH 1000000
#define MAX_NUM 99
void quicksort(int field[], int left, int right) {
int index_l, index_r, tmp;
index_l=left-1;
index_r=right;
for(;;){
while(field[++index_l]< field[right]);
while((index_r > index_l) && field[--index_r]>field[right]);
if(index_l>=index_r) break;
tmp=field[index_l]; field[index_l]=field[index_r]; field[index_r]=tmp;
}
tmp=field[index_l]; field[index_l]=field[right]; field[right]=tmp;
#pragma omp parallel sections
{
#pragma omp section
quicksort(field, left, index_l-1);
#pragma omp section
quicksort(field, index_l+1, right);
}
}
}
int main(int argc, char *args[]) {
int to_sort[LENGTH];
int index;
srand(time(NULL));
printf("Filling field...");
for (index = 0; index <= LENGTH-1; index++) {
to_sort[index] = rand()%(MAX_NUM - 1) + 1;
}
printf("done.\n");
printf("Sorting...");
quicksort(to_sort, 0, LENGTH-1);
printf("done.\n");
return 0;
}
But I usually have to do all the steps at least two times, until
reuseware accepts the code.
What can be the problem?
Regards,
Andreas Leha
|