Skip to content

Commit

Permalink
Uniform data (#46)
Browse files Browse the repository at this point in the history
made almost all functions in the expander take a single data argument
  • Loading branch information
azizghuloum authored Dec 18, 2024
1 parent a341af2 commit 3f36156
Show file tree
Hide file tree
Showing 26 changed files with 594 additions and 926 deletions.
4 changes: 2 additions & 2 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions examples/arrow-function-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const h = (x) => x((x) => f(x));
### Output Program

```typescript
export const f_2 = (x_8) => x_8;
export const g_4 = (x_9) => f_2(x_9);
export const h_6 = (x_10) => x_10((x_11) => f_2(x_11));
export const f_2 = (x_9) => x_9;
export const g_4 = (x_12) => f_2(x_12);
export const h_6 = (x_15) => x_15((x_18) => f_2(x_18));
```

4 changes: 2 additions & 2 deletions examples/arrow-function-3.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_4) => {
const bar_5 = x_4(13);
export const foo_2 = (x_5) => {
const bar_7 = x_5(13);
};
```

4 changes: 2 additions & 2 deletions examples/arrow-function-4.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_4) => {
x_4;
export const foo_2 = (x_5) => {
x_5;
};
```

4 changes: 2 additions & 2 deletions examples/arrow-function-5.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_4) => {
x_4;
export const foo_2 = (x_5) => {
x_5;
};
```

6 changes: 3 additions & 3 deletions examples/confused-parens-with-calls.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_4) => {
x_4;
x_4;
export const foo_2 = (x_5) => {
x_5;
x_5;
};
```

2 changes: 1 addition & 1 deletion examples/curry-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ using_rewrite_rules(
### Output Program

```typescript
(a_5) => (b_7) => (c_9) => (d_11) => a_5 + b_7 + c_9 + d_11;
(a_6) => (b_10) => (c_14) => (d_18) => a_6 + b_10 + c_14 + d_18;
```

2 changes: 1 addition & 1 deletion examples/curry-2.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ const curried =
### Output Program

```typescript
export const curried_3 = (a_6) => (b_8) => (c_10) => (d_12) => a_6 + b_8 + c_10 + d_12;
export const curried_3 = (a_7) => (b_11) => (c_15) => (d_19) => a_7 + b_11 + c_15 + d_19;
```

2 changes: 1 addition & 1 deletion examples/expr-dot-where.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ console.log(x + y).where(x = 1, y = x + 2);
### Output Program

```typescript
((x_4) => ((y_6) => console.log(x_4 + y_6))(x_4 + 2))(1);
((x_5) => ((y_9) => console.log(x_5 + y_9))(x_5 + 2))(1);
```

4 changes: 2 additions & 2 deletions examples/lexical-declarations-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export const y_4 = 13,
z_6: t_2 = y_4,
q_8: t_2,
r_10;
export const x_12 = (z_14) => {
const t_15 = z_14;
export const x_12 = (z_15) => {
const t_17 = z_15;
};
```

2 changes: 1 addition & 1 deletion examples/macro-generating-macro-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ using_rewrite_rules(
### Output Program

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

6 changes: 3 additions & 3 deletions examples/macro-generating-macro-2.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ using_rewrite_rules(
### Output Program

```typescript
(x_4) => {
const using_rewrite_rules_5 = 10;
(x_10) => x_10 + x_4;
(x_5) => {
const using_rewrite_rules_7 = 10;
(x_13) => x_13 + x_5;
};
```

2 changes: 1 addition & 1 deletion examples/not-test-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ using_rewrite_rules(
### Output Program

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

6 changes: 3 additions & 3 deletions examples/splice-2.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_4) => {
x_4;
x_4;
export const foo_2 = (x_5) => {
x_5;
x_5;
};
```

2 changes: 1 addition & 1 deletion examples/using-rewrite-rules-3.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const x = 12;
### Output Program

```typescript
(foo_7) => x_5 + x_5;
(foo_8) => x_5 + x_5;
export const x_5 = 12;
```

2 changes: 1 addition & 1 deletion examples/using-rewrite-rules-4.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const x = 12;
### Output Program

```typescript
x_6 + ((foo_8, foo_10) => foo_10 + foo_8);
x_6 + ((foo_9, foo_11) => foo_11 + foo_9);
export const x_6 = 12;
```

2 changes: 1 addition & 1 deletion rtsc/.rts/testing-file-extensions.rts.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"cid": "rtsc/testing-file-extensions.rts rewrite-ts-visualized 0.0.0",
"cookie": "rewrite-ts-007",
"cookie": "rewrite-ts-008",
"exported_identifiers": {
"x": [
{
Expand Down
20 changes: 20 additions & 0 deletions src/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { preexpand_helpers } from "./preexpand-helpers";
import { import_req, lexical_extension, modular_extension } from "./stx";
import { CompilationUnit, Context, Loc } from "./syntax-structures";

export type data = {
loc: Loc;
lexical: lexical_extension;
context: Context;
counter: number;
unit: CompilationUnit;
helpers: preexpand_helpers;
imp: import_req;
modular: modular_extension;
};

export type walker = (data: data) => Promise<data>;

export type walkerplus<T> = (data: data & T) => Promise<data>;

export type swalker = (data: data) => data;
Loading

0 comments on commit 3f36156

Please sign in to comment.