浏览代码

reorganisation

develop-theo
Theo Souchon 2 年前
父节点
当前提交
b5bf7d7d01
共有 349 个文件被更改,包括 166 次插入180 次删除
  1. +3
    -1
      AUTHORS
  2. +0
    -94
      README.md
  3. +1
    -0
      README.md
  4. +96
    -0
      doc/README.md
  5. +0
    -0
      doc/ccmeta.drawio.png
  6. +1
    -1
      examples/projectExample
  7. +19
    -0
      examples/projectExample.c
  8. +0
    -0
      examples/realObjectED
  9. +0
    -0
      examples/realObjectED.c
  10. +0
    -0
      examples/realObjectPF
  11. +0
    -0
      examples/realObjectPF.c
  12. +1
    -9
      src/ccmeta.leg
  13. +0
    -6
      src/object.c
  14. +4
    -18
      src/parsimonyLibrary/boot.mc
  15. +1
    -1
      src/parsimonyLibrary/dynamicObjectExtDecl.mc
  16. +1
    -1
      src/parsimonyLibrary/dynamicObjectParsFrom.mc
  17. +0
    -6
      src/tests/tests-parsimony/002
  18. +0
    -17
      src/tests/tests-parsimony/002.c
  19. +0
    -10
      src/tests/tests-parsimony/projectExample.c
  20. +9
    -9
      tests/dotest
  21. +0
    -0
      tests/tests-c/00001.c
  22. +0
    -0
      tests/tests-c/00002.c
  23. +0
    -0
      tests/tests-c/00003.c
  24. +0
    -0
      tests/tests-c/00004.c
  25. +0
    -0
      tests/tests-c/00005.c
  26. +0
    -0
      tests/tests-c/00006.c
  27. +0
    -0
      tests/tests-c/00007.c
  28. +0
    -0
      tests/tests-c/00008.c
  29. +0
    -0
      tests/tests-c/00009.c
  30. +0
    -0
      tests/tests-c/00010.c
  31. +0
    -0
      tests/tests-c/00011.c
  32. +0
    -0
      tests/tests-c/00012.c
  33. +0
    -0
      tests/tests-c/00013.c
  34. +0
    -0
      tests/tests-c/00014.c
  35. +0
    -0
      tests/tests-c/00015.c
  36. +0
    -0
      tests/tests-c/00016.c
  37. +0
    -0
      tests/tests-c/00017.c
  38. +0
    -0
      tests/tests-c/00018.c
  39. +0
    -0
      tests/tests-c/00019.c
  40. +0
    -0
      tests/tests-c/00020.c
  41. +0
    -0
      tests/tests-c/00021.c
  42. +0
    -0
      tests/tests-c/00022.c
  43. +0
    -0
      tests/tests-c/00023.c
  44. +0
    -0
      tests/tests-c/00024.c
  45. +0
    -0
      tests/tests-c/00025.c
  46. +0
    -0
      tests/tests-c/00026.c
  47. +0
    -0
      tests/tests-c/00027.c
  48. +0
    -0
      tests/tests-c/00028.c
  49. +0
    -0
      tests/tests-c/00029.c
  50. +0
    -0
      tests/tests-c/00030.c
  51. +0
    -0
      tests/tests-c/00031.c
  52. +0
    -0
      tests/tests-c/00032.c
  53. +0
    -0
      tests/tests-c/00033.c
  54. +0
    -0
      tests/tests-c/00034.c
  55. +0
    -0
      tests/tests-c/00035.c
  56. +0
    -0
      tests/tests-c/00036.c
  57. +0
    -0
      tests/tests-c/00037.c
  58. +0
    -0
      tests/tests-c/00038.c
  59. +0
    -0
      tests/tests-c/00039.c
  60. +0
    -0
      tests/tests-c/00040.c
  61. +0
    -0
      tests/tests-c/00041.c
  62. +0
    -0
      tests/tests-c/00042.c
  63. +0
    -0
      tests/tests-c/00043.c
  64. +0
    -0
      tests/tests-c/00044.c
  65. +0
    -0
      tests/tests-c/00045.c
  66. +0
    -0
      tests/tests-c/00046.c
  67. +0
    -0
      tests/tests-c/00047.c
  68. +0
    -0
      tests/tests-c/00048.c
  69. +0
    -0
      tests/tests-c/00049.c
  70. +0
    -0
      tests/tests-c/00050.c
  71. +0
    -0
      tests/tests-c/00051.c
  72. +0
    -0
      tests/tests-c/00052.c
  73. +0
    -0
      tests/tests-c/00053.c
  74. +0
    -0
      tests/tests-c/00054.c
  75. +0
    -0
      tests/tests-c/00055.c
  76. +0
    -0
      tests/tests-c/00056.c
  77. +0
    -0
      tests/tests-c/00057.c
  78. +0
    -0
      tests/tests-c/00058.c
  79. +0
    -0
      tests/tests-c/00059.c
  80. +0
    -0
      tests/tests-c/00060.c
  81. +0
    -0
      tests/tests-c/00061.c
  82. +0
    -0
      tests/tests-c/00064.c
  83. +0
    -0
      tests/tests-c/00065.c
  84. +0
    -0
      tests/tests-c/00072.c
  85. +0
    -0
      tests/tests-c/00073.c
  86. +0
    -0
      tests/tests-c/00075.c
  87. +0
    -0
      tests/tests-c/00076.c
  88. +0
    -0
      tests/tests-c/00077.c
  89. +0
    -0
      tests/tests-c/00078.c
  90. +0
    -0
      tests/tests-c/00079.c
  91. +0
    -0
      tests/tests-c/00080.c
  92. +0
    -0
      tests/tests-c/00081.c
  93. +0
    -0
      tests/tests-c/00082.c
  94. +0
    -0
      tests/tests-c/00083.c
  95. +0
    -0
      tests/tests-c/00084.c
  96. +0
    -0
      tests/tests-c/00085.c
  97. +0
    -0
      tests/tests-c/00086.c
  98. +0
    -0
      tests/tests-c/00087.c
  99. +0
    -0
      tests/tests-c/00088.c
  100. +0
    -0
      tests/tests-c/00089.c

+ 3
- 1
AUTHORS 查看文件

@ -13,4 +13,6 @@ Nathan Razafimanantsoa, Kumar Mahadayya (2021)
C AST
Theo Souchon (2022-2023)
?
metalanguage features, development, tests, examples
grammar, object system changes for metalanguage
source and repository reorganisation

+ 0
- 94
README.md 查看文件

@ -1,94 +0,0 @@
# CCMETA
C compiler with embedded metalanguage.
## <div id="toc">Table of contents<div>
1. [Architecture](#ar)
2. [Build the project](#bp)
- [Requirements](#ar)
- [Makefile](#makefile)
- [Build](#makefile_Build)
- [Clean](#makefile_Clean)
- [Test](#makefile_Test)
3. [Usage](#usage)
4. [Help](#help)
- [Peg/Leg](#pegleg)
5. [Authors](#authors)
## <div id="ar">Architecture<div>
![alt text](http://git.piumarta.com/piumarta/ccmeta/raw/branch/develop/src/images/ccmeta.drawio.png)
### [Go to the table of contents](#toc)
## <div id="bp">Build the project<div>
### <div id="req">Requirements<div>
Please install [peg/leg](https://www.piumarta.com/software/peg/) manually or with a package manager, for example with Homebrew:
```bash
$ brew install peg
```
Please install [the Boehm-Demers-Weiser conservative garbage collector](https://www.hboehm.info/gc/) manually or with a package manager, for example with Homebrew:
```bash
$ brew install bdw-gc
```
### <div id="makefile"> Makefile<div>
>Compatible with the homebrew installed on the apple silicon ship
#### <div id="makefile_Build">Build<div>
```bash
$ make
```
#### <div id="makefile_Clean">Clean<div>
```bash
$ make clean
```
#### <div id="makefile_Test">Test <div>
```bash
$ make test
```
### [Go to the table of contents](#toc)
## <div id="usage">Usage<div>
### How it works
You can pass your program:
* via an input file
```bash
$ ./ccmeta < file
```
* via a file
```bash
$ ./ccmeta file
```
### **Check each test file to get an idea of how parsimony works**
### [Go to the table of contents](#toc)
## <div id="help">Help<div>
### <div id="pegleg">peg/leg<div>
``` shell
$ man peg
```
### [Go to the table of contents](#toc)
## <div id="authors">Authors<div>
#### Ian Piumarta (2016-)
- infrastructure
- parsing framework
- C grammar, C AST
- object system design and implementation
- metalanguage design and implementation
#### Mahe Tardy (2020)
- object system implementation
- metalanguage implementation
#### Nathan Razafimanantsoa, Kumar Mahadayya (2021)
- C AST
#### Theo Souchon (2022-2023)
- ?

+ 1
- 0
README.md 查看文件

@ -0,0 +1 @@
doc/README.md

+ 96
- 0
doc/README.md 查看文件

@ -0,0 +1,96 @@
# CCMETA
C compiler with embedded metalanguage.
## <div id="toc">Table of contents<div>
1. [Architecture](#ar)
2. [Build the project](#bp)
- [Requirements](#ar)
- [Makefile](#makefile)
- [Build](#makefile_Build)
- [Clean](#makefile_Clean)
- [Test](#makefile_Test)
3. [Usage](#usage)
4. [Help](#help)
- [Peg/Leg](#pegleg)
5. [Authors](#authors)
## <div id="ar">Architecture<div>
![alt text](http://git.piumarta.com/piumarta/ccmeta/raw/branch/develop/src/images/ccmeta.drawio.png)
### [Go to the table of contents](#toc)
## <div id="bp">Build the project<div>
### <div id="req">Requirements<div>
Please install [peg/leg](https://www.piumarta.com/software/peg/) manually or with a package manager, for example with Homebrew:
```bash
$ brew install peg
```
Please install [the Boehm-Demers-Weiser conservative garbage collector](https://www.hboehm.info/gc/) manually or with a package manager, for example with Homebrew:
```bash
$ brew install bdw-gc
```
### <div id="makefile"> Makefile<div>
>Compatible with the homebrew installed on the apple silicon ship
#### <div id="makefile_Build">Build<div>
```bash
$ make
```
#### <div id="makefile_Clean">Clean<div>
```bash
$ make clean
```
#### <div id="makefile_Test">Test <div>
```bash
$ make test
```
### [Go to the table of contents](#toc)
## <div id="usage">Usage<div>
### How it works
You can pass your program:
* via an input file
```bash
$ ./ccmeta < file
```
* via a file
```bash
$ ./ccmeta file
```
### **Check each test file to get an idea of how parsimony works**
### [Go to the table of contents](#toc)
## <div id="help">Help<div>
### <div id="pegleg">peg/leg<div>
``` shell
$ man peg
```
### [Go to the table of contents](#toc)
## <div id="authors">Authors<div>
#### Ian Piumarta (2016-)
- infrastructure
- parsing framework
- C grammar, C AST
- object system design and implementation
- metalanguage design and implementation
#### Mahe Tardy (2020)
- object system implementation
- metalanguage implementation
#### Nathan Razafimanantsoa, Kumar Mahadayya (2021)
- C AST
#### Theo Souchon (2022-2023)
- metalanguage features, development, tests, examples
- grammar, object system changes for metalanguage
- source and repository reorganisation

src/images/ccmeta.drawio.png → doc/ccmeta.drawio.png 查看文件


src/tests/tests-parsimony/projectExample → examples/projectExample 查看文件

@ -1,3 +1,3 @@
enum foo { Closed = 0, ReadOnly = 1, WriteOnly = 2 };
static char *stateNames[] = { "Closed", "ReadOnly", "WriteOnly"};
static char *stateNames[] = { "Closed", "ReadOnly", "WriteOnly"};

+ 19
- 0
examples/projectExample.c 查看文件

@ -0,0 +1,19 @@
@{
mapast(f, seq)
{
out = {};
for (i in seq) {
e = seq[i];
out[length(out)] = e.__proto__ != Token ? f(e) : e ;
}
out;
}
idToString(x) { { __proto__: C_string, value: "\"" + string(x.name.identifier) + "\"" } }
nil;
}
enum foo { Closed = 0, ReadOnly = 1, WriteOnly = 2 };
static char *stateNames[] = { @(mapast(idToString, program.last.enumList)) };

src/tests/tests-parsimony/realObjectED → examples/realObjectED 查看文件


src/tests/tests-parsimony/realObjectED.c → examples/realObjectED.c 查看文件


src/tests/tests-parsimony/realObjectPF → examples/realObjectPF 查看文件


src/tests/tests-parsimony/realObjectPF.c → examples/realObjectPF.c 查看文件


+ 1
- 9
src/ccmeta.leg 查看文件

@ -2600,7 +2600,6 @@ MO_OPERATION = META_BACKTICK ( MO_CONSTANT c:constant { $$= newU
| MO_FUN f:functionDefinition { $$= newUnary(Quasiquote_proto, f) }
| MO_DECLARATION d:declaration { $$= newUnary(Quasiquote_proto, d) }
| MO_STATEMENT s:statement { $$= newUnary(Quasiquote_proto, s) }
| MO_ED e:externalDeclaration { $$= newUnary(Quasiquote_proto, e) }
)
MO_CONSTANT = 'constant' ![(a-zA-Z0-9_] --
@ -2609,7 +2608,6 @@ MO_EXPRESSION = 'expression' ![(a-zA-Z0-9_] --
MO_FUN = 'fun' ![(a-zA-Z0-9_] --
MO_DECLARATION = 'declaration' ![(a-zA-Z0-9_] --
MO_STATEMENT = 'statement' ![(a-zA-Z0-9_] --
MO_ED = 'ed' ![(a-zA-Z0-9_] --
#--------------------------------------------- Meta rules ----------------------------------------------#
@ -3710,7 +3708,7 @@ oop prim_print(oop scope, oop params)
}
return params;
}
//TRY
oop evalArgs(oop scope, oop args)
{
int i = 0;
@ -3739,15 +3737,9 @@ void readEvalPrint(oop scope, char *fileName)
int jbt= sigsetjmp(jbs->jb, 0);
if (0 == jbt) {
while (yyparse(&ctx)) {
// println(yylval);
if (!yylval) { // EOF
assert(top == inputStack);
break;
// fclose(inputStack->file);
// if (top == inputStack) break;
// inputStackPop();
// assert(inputStack);
// continue;
}
assert(yylval);
if (null == yylval) { // change of language or input file

+ 0
- 6
src/object.c 查看文件

@ -548,12 +548,6 @@ oop map_append(oop map, oop value)
return map_set(map, makeInteger(map_size(map)), value);
}
oop map_appendNonNil(oop map, oop value)
{
if (value != null) map_set(map, makeInteger(map_size(map)), value);
return value;
}
oop map_pop(oop map)
{ assert(map_isArray(map));
size_t size = get(map, Map, size);

+ 4
- 18
src/parsimonyLibrary/boot.mc 查看文件

@ -99,24 +99,10 @@
map(f, seq, g)
{
out = {};
if (g)
{
for (i in seq)
{
e = seq[i];
if (g(e))
{
e = f(e);
}
append(out, e);
}
}
else
{
for (i in seq)
{
append(out, f(seq[i]));
}
if (!g) g = (){ 1 };
for (i in seq) {
e = seq[i];
out[length(out)] = g(e) ? f(e) : e ;
}
out;
}

+ 1
- 1
src/parsimonyLibrary/dynamicObjectExtDecl.mc 查看文件

@ -105,7 +105,7 @@ struct __oop { int class; };
typedef struct __oop *oop;
@import("parsimonyLibrary/boot.mc")
@import("../src/parsimonyLibrary/boot.mc")
@{

+ 1
- 1
src/parsimonyLibrary/dynamicObjectParsFrom.mc 查看文件

@ -105,7 +105,7 @@ struct __oop { int class; };
typedef struct __oop *oop;
@import("parsimonyLibrary/boot.mc")
@import("../src/parsimonyLibrary/boot.mc")
@{

+ 0
- 6
src/tests/tests-parsimony/002 查看文件

@ -1,6 +0,0 @@
char t = 10;
int i = 2;
int q = 10;
int k = (1,2,"stringy thingy",21<<1);
int i = (1,2,"string",21<<1);
int w = 10;

+ 0
- 17
src/tests/tests-parsimony/002.c 查看文件

@ -1,17 +0,0 @@
@{
saved = `expression (1,2,"string",21<<1);
first = `constant 2;
nil;
}
@{
second = `constant 10;
nil;
}
char t = @(`constant @second);
int i = @first;
int q = @(`constant 10);
int k = @(`expression (1,2,"stringy thingy",21<<1));
int i = @saved;
int w = @second;

+ 0
- 10
src/tests/tests-parsimony/projectExample.c 查看文件

@ -1,10 +0,0 @@
@{import("parsimonyLibrary/boot.mc");}
enum foo { Closed = 0, ReadOnly = 1, WriteOnly = 2 };
@{
idToString(x) {{ __proto__: C_string, value: "\"" + string(x.name.identifier) + "\"" }}
nil;
}
static char *stateNames[] = { @(map(idToString, program.last.enumList, notToken)) };

src/dotest → tests/dotest 查看文件

@ -1,11 +1,11 @@
#!/bin/sh
make
make -C ../src
if test $# -gt 0; then
run="$@"
else
run="./ccmeta"
run="../src/ccmeta"
fi
die()
@ -14,37 +14,37 @@ die()
exit 1
}
for i in tests/tests-parsimony/*.c; do
for i in tests-parsimony/*.c; do
echo $i
j="${i%.c}"
k="tests/tests-parsimony/tmp.out"
k="tests-parsimony/tmp.out"
$run $i > $k
cmp $k $j || die $k $j
done
rm tests/tests-parsimony/tmp.out
rm tests-parsimony/tmp.out
for i in tests/tests-std/*.c; do
for i in tests-std/*.c; do
echo $i
j="${i%.c}.out"
$run < $i > $j
cmp $i $j || die $i $j
done
for i in tests/tests-gnu/*.c; do
for i in tests-gnu/*.c; do
echo $i
j="${i%.c}.out"
$run < $i > $j
cmp $i $j || die $i $j
done
for i in tests/tests-err/*.c; do
for i in tests-err/*.c; do
echo $i
j="${i%.c}.out"
$run < $i > $j
cmp -s $i $j || echo failed
done
for i in tests/tests-c/*.c; do
for i in tests-c/*.c; do
echo $i
j="${i%.c}.out"
$run < $i > $j

src/tests/tests-c/00001.c → tests/tests-c/00001.c 查看文件


src/tests/tests-c/00002.c → tests/tests-c/00002.c 查看文件


src/tests/tests-c/00003.c → tests/tests-c/00003.c 查看文件


src/tests/tests-c/00004.c → tests/tests-c/00004.c 查看文件


src/tests/tests-c/00005.c → tests/tests-c/00005.c 查看文件


src/tests/tests-c/00006.c → tests/tests-c/00006.c 查看文件


src/tests/tests-c/00007.c → tests/tests-c/00007.c 查看文件


src/tests/tests-c/00008.c → tests/tests-c/00008.c 查看文件


src/tests/tests-c/00009.c → tests/tests-c/00009.c 查看文件


src/tests/tests-c/00010.c → tests/tests-c/00010.c 查看文件


src/tests/tests-c/00011.c → tests/tests-c/00011.c 查看文件


src/tests/tests-c/00012.c → tests/tests-c/00012.c 查看文件


src/tests/tests-c/00013.c → tests/tests-c/00013.c 查看文件


src/tests/tests-c/00014.c → tests/tests-c/00014.c 查看文件


src/tests/tests-c/00015.c → tests/tests-c/00015.c 查看文件


src/tests/tests-c/00016.c → tests/tests-c/00016.c 查看文件


src/tests/tests-c/00017.c → tests/tests-c/00017.c 查看文件


src/tests/tests-c/00018.c → tests/tests-c/00018.c 查看文件


src/tests/tests-c/00019.c → tests/tests-c/00019.c 查看文件


src/tests/tests-c/00020.c → tests/tests-c/00020.c 查看文件


src/tests/tests-c/00021.c → tests/tests-c/00021.c 查看文件


src/tests/tests-c/00022.c → tests/tests-c/00022.c 查看文件


src/tests/tests-c/00023.c → tests/tests-c/00023.c 查看文件


src/tests/tests-c/00024.c → tests/tests-c/00024.c 查看文件


src/tests/tests-c/00025.c → tests/tests-c/00025.c 查看文件


src/tests/tests-c/00026.c → tests/tests-c/00026.c 查看文件


src/tests/tests-c/00027.c → tests/tests-c/00027.c 查看文件


src/tests/tests-c/00028.c → tests/tests-c/00028.c 查看文件


src/tests/tests-c/00029.c → tests/tests-c/00029.c 查看文件


src/tests/tests-c/00030.c → tests/tests-c/00030.c 查看文件


src/tests/tests-c/00031.c → tests/tests-c/00031.c 查看文件


src/tests/tests-c/00032.c → tests/tests-c/00032.c 查看文件


src/tests/tests-c/00033.c → tests/tests-c/00033.c 查看文件


src/tests/tests-c/00034.c → tests/tests-c/00034.c 查看文件


src/tests/tests-c/00035.c → tests/tests-c/00035.c 查看文件


src/tests/tests-c/00036.c → tests/tests-c/00036.c 查看文件


src/tests/tests-c/00037.c → tests/tests-c/00037.c 查看文件


src/tests/tests-c/00038.c → tests/tests-c/00038.c 查看文件


src/tests/tests-c/00039.c → tests/tests-c/00039.c 查看文件


src/tests/tests-c/00040.c → tests/tests-c/00040.c 查看文件


src/tests/tests-c/00041.c → tests/tests-c/00041.c 查看文件


src/tests/tests-c/00042.c → tests/tests-c/00042.c 查看文件


src/tests/tests-c/00043.c → tests/tests-c/00043.c 查看文件


src/tests/tests-c/00044.c → tests/tests-c/00044.c 查看文件


src/tests/tests-c/00045.c → tests/tests-c/00045.c 查看文件


src/tests/tests-c/00046.c → tests/tests-c/00046.c 查看文件


src/tests/tests-c/00047.c → tests/tests-c/00047.c 查看文件


src/tests/tests-c/00048.c → tests/tests-c/00048.c 查看文件


src/tests/tests-c/00049.c → tests/tests-c/00049.c 查看文件


src/tests/tests-c/00050.c → tests/tests-c/00050.c 查看文件


src/tests/tests-c/00051.c → tests/tests-c/00051.c 查看文件


src/tests/tests-c/00052.c → tests/tests-c/00052.c 查看文件


src/tests/tests-c/00053.c → tests/tests-c/00053.c 查看文件


src/tests/tests-c/00054.c → tests/tests-c/00054.c 查看文件


src/tests/tests-c/00055.c → tests/tests-c/00055.c 查看文件


src/tests/tests-c/00056.c → tests/tests-c/00056.c 查看文件


src/tests/tests-c/00057.c → tests/tests-c/00057.c 查看文件


src/tests/tests-c/00058.c → tests/tests-c/00058.c 查看文件


src/tests/tests-c/00059.c → tests/tests-c/00059.c 查看文件


src/tests/tests-c/00060.c → tests/tests-c/00060.c 查看文件


src/tests/tests-c/00061.c → tests/tests-c/00061.c 查看文件


src/tests/tests-c/00064.c → tests/tests-c/00064.c 查看文件


src/tests/tests-c/00065.c → tests/tests-c/00065.c 查看文件


src/tests/tests-c/00072.c → tests/tests-c/00072.c 查看文件


src/tests/tests-c/00073.c → tests/tests-c/00073.c 查看文件


src/tests/tests-c/00075.c → tests/tests-c/00075.c 查看文件


src/tests/tests-c/00076.c → tests/tests-c/00076.c 查看文件


src/tests/tests-c/00077.c → tests/tests-c/00077.c 查看文件


src/tests/tests-c/00078.c → tests/tests-c/00078.c 查看文件


src/tests/tests-c/00079.c → tests/tests-c/00079.c 查看文件


src/tests/tests-c/00080.c → tests/tests-c/00080.c 查看文件


src/tests/tests-c/00081.c → tests/tests-c/00081.c 查看文件


src/tests/tests-c/00082.c → tests/tests-c/00082.c 查看文件


src/tests/tests-c/00083.c → tests/tests-c/00083.c 查看文件


src/tests/tests-c/00084.c → tests/tests-c/00084.c 查看文件


src/tests/tests-c/00085.c → tests/tests-c/00085.c 查看文件


src/tests/tests-c/00086.c → tests/tests-c/00086.c 查看文件


src/tests/tests-c/00087.c → tests/tests-c/00087.c 查看文件


src/tests/tests-c/00088.c → tests/tests-c/00088.c 查看文件


src/tests/tests-c/00089.c → tests/tests-c/00089.c 查看文件


部分文件因为文件数量过多而无法显示

正在加载...
取消
保存