Procházet zdrojové kódy

new example of simplification

develop-theo
Theo Souchon před 2 roky
rodič
revize
c95443c520
11 změnil soubory, kde provedl 21 přidání a 35 odebrání
  1. +0
    -4
      boot.mc
  2. +2
    -1
      ccmeta.leg
  3. +0
    -0
      tests-parsimony/parsimony-lang/001.c
  4. +0
    -0
      tests-parsimony/parsimony-lang/002.c
  5. +13
    -1
      tests-parsimony/parsimony-lang/003.c
  6. +0
    -0
      tests-parsimony/parsimony-lang/004.c
  7. +2
    -2
      tests-parsimony/parsimony-lang/005.c
  8. +2
    -2
      tests-parsimony/parsimony-lang/006.c
  9. +1
    -1
      tests-parsimony/parsimony-lang/007.c
  10. +0
    -23
      tests-parsimony/parsimony-lang/map.c
  11. +1
    -1
      tests-parsimony/projExample.c

+ 0
- 4
boot.mc Zobrazit soubor

@ -1,8 +1,4 @@
@{
createList() {
return {};
}
append(s, e) {
s[length(s)] = e;
}

+ 2
- 1
ccmeta.leg Zobrazit soubor

@ -1368,6 +1368,7 @@ integerConstant = < ( hexadecimalConstant
| decimalConstant
) integerSuffix?
> { $$= new_C_int(yytext); } -
| META_AT mvalue
decimalConstant = [1-9][0-9]*
@ -2177,7 +2178,7 @@ mstmts = ( s:eval_stmt )* ( META_NIL META_SEMICOLON META_RCB { $$= null
| META_RCB { $$= s }
)
eval_stmt = s:meta_stmt { $$= eval(globals, s) }
eval_stmt = s:meta_stmt { $$= eval(globals, s) }
meta_stmt = s:meta_block { $$= s }
| META_SEMICOLON { $$= null }

tests-parsimony/001.c → tests-parsimony/parsimony-lang/001.c Zobrazit soubor


tests-parsimony/002.c → tests-parsimony/parsimony-lang/002.c Zobrazit soubor


tests-parsimony/003.c → tests-parsimony/parsimony-lang/003.c Zobrazit soubor

@ -11,7 +11,19 @@
int main()
{
@{
l = createList();
l = {};
append(l, forLoop);
if (useForLoop) {
append(l, forLoop);
} else {
append(l, whileLoop);
}
l;
};
@{
l = {};
useForLoop = 0;
append(l, forLoop);
if (useForLoop) {
append(l, forLoop);
} else {

tests-parsimony/004.c → tests-parsimony/parsimony-lang/004.c Zobrazit soubor


tests-parsimony/005.c → tests-parsimony/parsimony-lang/005.c Zobrazit soubor

@ -1,7 +1,7 @@
@{import("boot.mc");}
@{
l = createList();
l = {};
append(l, `declaration int a = 5;);
append(l, `declaration int b = 2;);
l;
@ -9,7 +9,7 @@
int main() {
@{
l = createList();
l = {};
a = (`declaration int a = 2;);
append(l, `declaration int c = 5;);
b = 5;

tests-parsimony/006.c → tests-parsimony/parsimony-lang/006.c Zobrazit soubor

@ -1,7 +1,7 @@
@{import("boot.mc");}
@{
l = createList();
l = {};
append(l, `declaration int a = 5;);
a = (`declaration int a = 5;);
append(l, `declaration int a = 5;);
@ -19,7 +19,7 @@ int main() {
@a;
int b = 0;
@{
l = createList();
l = {};
append(l, `declaration int c = 0;);
x = (`declaration int d = 5;);
append(l, x);

tests-parsimony/007.c → tests-parsimony/parsimony-lang/007.c Zobrazit soubor

@ -1,7 +1,7 @@
@{import("boot.mc");}
@{
l = createList();
l = {};
append(l, `declaration int a = 0;);
a = (`declaration int b = 0;);
append(l, a);

tests-parsimony/map.c → tests-parsimony/parsimony-lang/map.c Zobrazit soubor

@ -1,28 +1,5 @@
@{import("boot.mc");}
@{
toChar(foo) {
"\"type :"+foo+"\"";
}
p2(foo) {
foo * foo;
}
c = ["earth", "sky", "water"];
isSky(x) { x == "sky" }
c = reject(isSky, c);
nil;
}
@{
print(map(p2, [100, 2, 3]));
nil;
}
@{
print(map(toChar, c));
nil;
}
enum foo { A, B, C };
enum oof { A, B, C };

+ 1
- 1
tests-parsimony/projExample.c Zobrazit soubor

@ -8,4 +8,4 @@ enum foo { Closed = 0, ReadOnly = 1, WriteOnly = 2 };
nil;
}
static char stateNames[] = { @(map(idToString, properties.enums.foo.enumList, notToken)) };
static char *stateNames[] = { @(map(idToString, properties.enums.foo.enumList, notToken)) };

Načítá se…
Zrušit
Uložit