future-lang 0.3.1 → 0.3.2
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 +46 -5
- package/package.json +1 -1
- package/src/cli.js +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Future reads like plain English, runs on Node.js, and gives every program built-
|
|
|
9
9
|
## Quick start
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install future-lang
|
|
12
|
+
npm install -g future-lang
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
```future
|
|
@@ -331,8 +331,49 @@ Open `future-playground.html` in any browser for a live editor with 11 built-in
|
|
|
331
331
|
## CLI
|
|
332
332
|
|
|
333
333
|
```bash
|
|
334
|
+
npm install -g future-lang
|
|
335
|
+
|
|
336
|
+
future --version # show version
|
|
337
|
+
future new myapp # create a new project
|
|
334
338
|
future run program.future # compile + run
|
|
335
|
-
future compile program.future #
|
|
339
|
+
future compile program.future # compile to JavaScript
|
|
340
|
+
future check program.future # syntax check only
|
|
341
|
+
future fmt program.future # format source in-place
|
|
342
|
+
future playground # launch the interactive playground
|
|
343
|
+
future doctor # check your environment
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Import system
|
|
349
|
+
|
|
350
|
+
Split code across files with `use`:
|
|
351
|
+
|
|
352
|
+
```future
|
|
353
|
+
# utils.future
|
|
354
|
+
function formatName(name)
|
|
355
|
+
return "User: {name}"
|
|
356
|
+
end
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
```future
|
|
360
|
+
# main.future
|
|
361
|
+
|
|
362
|
+
# import all functions by name
|
|
363
|
+
use "./utils.future"
|
|
364
|
+
print formatName("Alice")
|
|
365
|
+
|
|
366
|
+
# import as a namespace
|
|
367
|
+
use "./math.future" as m
|
|
368
|
+
result = m.add(10, 20)
|
|
369
|
+
print result
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Compiles to standard ES module imports:
|
|
373
|
+
|
|
374
|
+
```js
|
|
375
|
+
import { formatName } from "./utils.js";
|
|
376
|
+
import * as m from "./math.js";
|
|
336
377
|
```
|
|
337
378
|
|
|
338
379
|
---
|
|
@@ -365,6 +406,6 @@ Source (.future) → Lexer → Parser → Generator → JavaScript
|
|
|
365
406
|
|
|
366
407
|
## Documentation
|
|
367
408
|
|
|
368
|
-
- [ARCHITECTURE.md](ARCHITECTURE.md) — compiler pipeline, folder structure, AST node types
|
|
369
|
-
- [ROADMAP.md](ROADMAP.md) — feature status and priorities
|
|
370
|
-
- [MIGRATION.md](MIGRATION.md) — changelog, what changed between versions
|
|
409
|
+
- [ARCHITECTURE.md](https://github.com/humolot/future-lang/blob/main/ARCHITECTURE.md) — compiler pipeline, folder structure, AST node types
|
|
410
|
+
- [ROADMAP.md](https://github.com/humolot/future-lang/blob/main/ROADMAP.md) — feature status and priorities
|
|
411
|
+
- [MIGRATION.md](https://github.com/humolot/future-lang/blob/main/MIGRATION.md) — changelog, what changed between versions
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -21,7 +21,7 @@ import { compile, tokenize, parse } from './index.js';
|
|
|
21
21
|
import { format } from './formatter.js';
|
|
22
22
|
import { FutureError } from './errors.js';
|
|
23
23
|
|
|
24
|
-
const VERSION = '0.3.
|
|
24
|
+
const VERSION = '0.3.2';
|
|
25
25
|
const PROJECT_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
26
26
|
const RUNTIME_INDEX = join(PROJECT_ROOT, 'runtime', 'index.js');
|
|
27
27
|
|