Skip to content

Commit

Permalink
generating markdown for test results (#2)
Browse files Browse the repository at this point in the history
* generating markdown for test results

* capitalizing section names and fixing md for errors

* moved md files to examples dir

* removed old tests
  • Loading branch information
azizghuloum authored Nov 25, 2024
1 parent 87bba6b commit d41cbd8
Show file tree
Hide file tree
Showing 35 changed files with 377 additions and 84 deletions.
20 changes: 20 additions & 0 deletions examples/arrow-function-1.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## `arrow-function-1.ts`

### Status: `DONE`

### Input Program

```typescript
const f = (x) => x;
const g = (x) => f(x);
const h = (x) => x((x) => f(x));
```

### Output Program

```typescript
const f_3 = (x_9) => x_9;
const g_5 = (x_9) => f_3(x_9);
const h_7 = (x_9) => x_9((x_12) => f_3(x_12));
```

23 changes: 23 additions & 0 deletions examples/arrow-function-2.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## `arrow-function-2.ts`

### Status: `SyntaxError`

```
x is already defined in normal_env
```

### Input Program

```typescript
const foo = (x) => {
// should give a syntax error
const x = 13;
};
```

### Output Program

```typescript
const /*>>>*/ x /*<<<*/ = 13;
```

20 changes: 20 additions & 0 deletions examples/arrow-function-3.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## `arrow-function-3.ts`

### Status: `DONE`

### Input Program

```typescript
const foo = (x) => {
const bar = x(13);
};
```

### Output Program

```typescript
const foo_3 = (x_5) => {
const bar_8 = x_5(13);
};
```

20 changes: 20 additions & 0 deletions examples/arrow-function-4.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## `arrow-function-4.ts`

### Status: `DONE`

### Input Program

```typescript
const foo = (x) => {
using_syntax_rules([t,t,x]).rewrite(t);
}
```

### Output Program

```typescript
const foo_3 = (x_5) => {
x_5;
};
```

22 changes: 22 additions & 0 deletions examples/arrow-function-5.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## `arrow-function-5.ts`

### Status: `DONE`

### Input Program

```typescript
const foo = (x) => {
using_syntax_rules([t,t,x]).rewrite(splice(() => {
t
}));
}
```

### Output Program

```typescript
const foo_3 = (x_5) => {
x_5;
};
```

18 changes: 18 additions & 0 deletions examples/left-matching-1.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## `left-matching-1.ts`

### Status: `DONE`

### Input Program

```typescript
using_syntax_rules(
[foo, op(x,foo,y), op - x + y],
).rewrite(12(1,foo,3))
```

### Output Program

```typescript
12 - 1 + 3;
```

23 changes: 23 additions & 0 deletions examples/left-matching-2.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## `left-matching-2.ts`

### Status: `DONE`

### Input Program

```typescript
using_syntax_rules(
[foo, [pre](xs,foo,ys)(args), [[pre],[xs],[ys],[args]]],
).rewrite([7,8,9](1,2,3,foo,4,5,6)(10,11,12))
```

### Output Program

```typescript
[
[7, 8, 9],
[1, 2, 3],
[4, 5, 6],
[10, 11, 12],
];
```

20 changes: 20 additions & 0 deletions examples/macro-generating-macro-1.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## `macro-generating-macro-1.ts`

### Status: `DONE`

### Input Program

```typescript
using_syntax_rules(
[capture,
capture(expr, id, body),
using_syntax_rules([id, id, expr]).rewrite(body)],
).rewrite((x) => capture(x, t, (x) => x + t))
```

### Output Program

```typescript
(x_5) => (x_11) => x_11 + x_5;
```

20 changes: 20 additions & 0 deletions examples/not-test-1.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## `not-test-1.ts`

### Status: `DONE`

### Input Program

```typescript
using_syntax_rules(
[not, not(x) ? a : b, x ? b : a],
[not, not(x), !x],
[not, not, (x) => not(x)],
).rewrite(not(not(not(1))) ? not : not(3))
```

### Output Program

```typescript
1 ? !3 : (x_10) => !x_10;
```

24 changes: 24 additions & 0 deletions examples/splice-1.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## `splice-1.ts`

### Status: `DONE`

### Input Program

```typescript
const t = 13;
splice(() => {
const x = 17;
const y = x + t;
});
const q = t + x;
```

### Output Program

```typescript
const t_3 = 13;
const x_5 = 17;
const y_7 = x_5 + t_3;
const q_9 = t_3 + x_5;
```

24 changes: 24 additions & 0 deletions examples/splice-2.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## `splice-2.ts`

### Status: `DONE`

### Input Program

```typescript
const foo = (x) => {
using_syntax_rules([t,t,x]).rewrite(splice(() => {
t;
t;
}));
}
```

### Output Program

```typescript
const foo_3 = (x_5) => {
x_5;
x_5;
};
```

18 changes: 18 additions & 0 deletions examples/test-1.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## `test-1.ts`

### Status: `DONE`

### Input Program

```typescript
const x = 12;
x;
```

### Output Program

```typescript
const x_3 = 12;
x_3;
```

18 changes: 18 additions & 0 deletions examples/test-2.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## `test-2.ts`

### Status: `DONE`

### Input Program

```typescript
const x = 12;
x + x;
```

### Output Program

```typescript
const x_3 = 12;
x_3 + x_3;
```

21 changes: 21 additions & 0 deletions examples/using-syntax-rules-1.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## `using-syntax-rules-1.ts`

### Status: `DONE`

### Input Program

```typescript
using_syntax_rules(
[foo, foo(x), x],
//[foo, { literals: [name], capturing: [d], nonrecursive: [bar] }, foo.name, "foo"],
//[foo, foo.prop, "foo"],
//[foo, foo, 17],
).rewrite(foo(12));
```

### Output Program

```typescript
12;
```

21 changes: 21 additions & 0 deletions examples/using-syntax-rules-2.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## `using-syntax-rules-2.ts`

### Status: `DONE`

### Input Program

```typescript
using_syntax_rules(
[foo, foo(x), x + x],
[foo, foo, x]
).rewrite(foo(foo));
const x = 12;
```

### Output Program

```typescript
x_8 + x_8;
const x_8 = 12;
```

21 changes: 21 additions & 0 deletions examples/using-syntax-rules-3.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## `using-syntax-rules-3.ts`

### Status: `DONE`

### Input Program

```typescript
using_syntax_rules(
[foo, foo(x), (foo) => x + x],
[foo, foo, x]
).rewrite(foo(foo));
const x = 12;
```

### Output Program

```typescript
(foo_8) => x_6 + x_6;
const x_6 = 12;
```

22 changes: 22 additions & 0 deletions examples/using-syntax-rules-4.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## `using-syntax-rules-4.ts`

### Status: `DONE`

### Input Program

```typescript
using_syntax_rules(
[foo, foo(x), foo + ((x, foo) => foo + x)],
[foo, foo, x]
).rewrite(foo(foo))

const x = 12;
```

### Output Program

```typescript
x_7 + ((foo_9, foo_11) => foo_11 + foo_9);
const x_7 = 12;
```

Loading

0 comments on commit d41cbd8

Please sign in to comment.