epoxylang 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -319
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
# Epoxy Language
|
|
2
|
-
|
|
3
|
-
Epoxy is a small, expressive programming language that compiles to JavaScript.
|
|
4
|
-
It is designed to be readable, explicit and strict while remaining close to core programming concepts.
|
|
5
|
-
|
|
6
|
-
Epoxy focuses on:
|
|
7
|
-
- Clear English-like syntax
|
|
8
|
-
- Explicit intent (assign vs store)
|
|
9
|
-
- Predictable execution
|
|
10
|
-
- JavaScript as a compilation target
|
|
11
|
-
|
|
12
|
-
The project includes:
|
|
13
|
-
- A lexer
|
|
14
|
-
- A parser
|
|
15
|
-
- An AST
|
|
16
|
-
- A JavaScript code generator
|
|
17
|
-
- A CLI runner
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
|
|
23
|
-
### Global installation (recommended)
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install -g epoxylang
|
|
27
|
-
````
|
|
28
|
-
|
|
29
|
-
Verify installation:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
epoxy --help
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
If you are using Git Bash on Windows and the command is not found, ensure your npm global bin directory is in `PATH`:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
C:\Users\<your-username>\AppData\Roaming\npm
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Running an Epoxy Program
|
|
44
|
-
|
|
45
|
-
Epoxy source files use the `.epx` extension.
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
epoxy file.epx
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Example:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
epoxy examples/demo.epx
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Your First Program
|
|
60
|
-
|
|
61
|
-
Create a file called `hello.epx`:
|
|
62
|
-
|
|
63
|
-
```epx
|
|
64
|
-
assign mymsg = "Hello, Epoxy";
|
|
65
|
-
show mymsg;
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Run it:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
epoxy hello.epx
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Output:
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
Hello, Epoxy
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## Language Overview
|
|
83
|
-
|
|
84
|
-
### Variables
|
|
85
|
-
|
|
86
|
-
Epoxy distinguishes between **computed values** and **stored strings**.
|
|
87
|
-
|
|
88
|
-
#### assign — for values and expressions
|
|
89
|
-
|
|
90
|
-
```epx
|
|
91
|
-
assign x = 5;
|
|
92
|
-
assign y as int = 10;
|
|
93
|
-
assign flag as bool = true;
|
|
94
|
-
assign mymsg as string = "Hello, Epoxy"
|
|
95
|
-
assign myarray as array = {1,2,3,4};
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Global variables:
|
|
99
|
-
|
|
100
|
-
```epx
|
|
101
|
-
all assign version = 1;
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Type annotation is optional, but required when assigning a function call result.
|
|
105
|
-
|
|
106
|
-
Supported types:
|
|
107
|
-
|
|
108
|
-
* `int`
|
|
109
|
-
* `string`
|
|
110
|
-
* `bool`
|
|
111
|
-
* `array`
|
|
112
|
-
* `null`
|
|
113
|
-
* `undefined`
|
|
114
|
-
* `object`
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
### store — for interpolated strings
|
|
119
|
-
|
|
120
|
-
`store` is used only for backtick strings and supports interpolation.
|
|
121
|
-
|
|
122
|
-
```epx
|
|
123
|
-
store msg = `Value of ex is 69`;
|
|
124
|
-
show msg;
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Function calls or variable inside `store` **must** be wrapped in `[ ]`.
|
|
128
|
-
|
|
129
|
-
```epx
|
|
130
|
-
store result = `Sum is [call add[2, 3]]`;
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## Functions
|
|
136
|
-
|
|
137
|
-
### Defining a function
|
|
138
|
-
|
|
139
|
-
```epx
|
|
140
|
-
make add[a, b] {
|
|
141
|
-
give a + b;
|
|
142
|
-
}
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Calling a function
|
|
146
|
-
|
|
147
|
-
```epx
|
|
148
|
-
call add[2,3];
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
or
|
|
152
|
-
|
|
153
|
-
```epx
|
|
154
|
-
assign result as int = call add[2, 3];
|
|
155
|
-
show result;
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Function calls assigned to variables **require a datatype**.
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## Control Flow
|
|
163
|
-
|
|
164
|
-
### Conditional statements
|
|
165
|
-
|
|
166
|
-
```epx
|
|
167
|
-
assign x = 10;
|
|
168
|
-
check [x > 5] {
|
|
169
|
-
store ok = `[x] is greater than 5`;
|
|
170
|
-
show ok;
|
|
171
|
-
}
|
|
172
|
-
or check [x == 5] {
|
|
173
|
-
store ok = `[x] is equal to 5`;
|
|
174
|
-
show ok;
|
|
175
|
-
}
|
|
176
|
-
alt {
|
|
177
|
-
store ok = `[x] is smaller than 5`;
|
|
178
|
-
show ok;
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
Supported logical operators:
|
|
183
|
-
|
|
184
|
-
* `and`
|
|
185
|
-
* `or`
|
|
186
|
-
|
|
187
|
-
---
|
|
188
|
-
|
|
189
|
-
## Loops
|
|
190
|
-
|
|
191
|
-
### Repeat (for-style loop)
|
|
192
|
-
|
|
193
|
-
```epx
|
|
194
|
-
repeat [i in 0 to 5, 1] {
|
|
195
|
-
show i;
|
|
196
|
-
}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
Syntax:
|
|
200
|
-
|
|
201
|
-
```
|
|
202
|
-
repeat [variable in start to end, step] { ... }
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
### Repeat until (do-until loop)
|
|
208
|
-
|
|
209
|
-
```epx
|
|
210
|
-
assign x = 0;
|
|
211
|
-
|
|
212
|
-
repeat until [x > 3] {
|
|
213
|
-
show x;
|
|
214
|
-
assign x = x + 1;
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
## Arrays
|
|
221
|
-
|
|
222
|
-
### Array declaration
|
|
223
|
-
|
|
224
|
-
```epx
|
|
225
|
-
assign nums as array = {1, 2, 3, 4};
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Array access
|
|
229
|
-
|
|
230
|
-
```epx
|
|
231
|
-
show nums{2};
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
---
|
|
235
|
-
|
|
236
|
-
## Expressions
|
|
237
|
-
|
|
238
|
-
Epoxy supports standard arithmetic and comparison expressions:
|
|
239
|
-
|
|
240
|
-
```epx
|
|
241
|
-
assign total = 10 + 10 * 2;
|
|
242
|
-
assign valid = 10 > 3 and 10 < 10;
|
|
243
|
-
show total;
|
|
244
|
-
show valid;
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
|
-
## Compilation Model
|
|
250
|
-
|
|
251
|
-
Epoxy programs are compiled to JavaScript and executed by Node.js.
|
|
252
|
-
|
|
253
|
-
Example Epoxy code:
|
|
254
|
-
|
|
255
|
-
```epx
|
|
256
|
-
assign x = 5;
|
|
257
|
-
show x;
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
Generated JavaScript:
|
|
261
|
-
|
|
262
|
-
```js
|
|
263
|
-
let x = 5;
|
|
264
|
-
console.log(x);
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
## CLI Behavior
|
|
270
|
-
|
|
271
|
-
* Epoxy compiles and runs code in one step
|
|
272
|
-
* Errors are reported during parsing or execution
|
|
273
|
-
* The runtime uses Node.js
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Project Structure
|
|
278
|
-
|
|
279
|
-
```
|
|
280
|
-
src/
|
|
281
|
-
├── lexer/
|
|
282
|
-
│ ├── lexer.js
|
|
283
|
-
│ └── tokens.js
|
|
284
|
-
├── parser/
|
|
285
|
-
│ ├── parser.js
|
|
286
|
-
│ └── ast.js
|
|
287
|
-
├── generator/
|
|
288
|
-
│ └── jsgenerator.js
|
|
289
|
-
├── runtime/
|
|
290
|
-
│ └── runner.js
|
|
291
|
-
bin/
|
|
292
|
-
└── epoxy.js
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
---
|
|
296
|
-
|
|
297
|
-
## Versioning
|
|
298
|
-
|
|
299
|
-
Epoxy follows semantic versioning:
|
|
300
|
-
|
|
301
|
-
```
|
|
302
|
-
MAJOR.MINOR.PATCH
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
Until `1.0.0`, breaking changes may occur between minor versions.
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
## License
|
|
310
|
-
|
|
311
|
-
MIT License
|
|
312
|
-
|
|
313
|
-
---
|
|
314
|
-
|
|
315
|
-
## Status
|
|
316
|
-
|
|
317
|
-
Epoxy is an experimental language project intended for learning, exploration, and language design experimentation.
|
|
318
|
-
|
|
319
|
-
Contributions, ideas, and discussions are welcome.
|