eolang 0.21.1 → 0.23.0
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 +16 -9
- package/eo-version.txt +1 -1
- package/home-tag.txt +1 -0
- package/mvnw/.mvn/wrapper/maven-wrapper.properties +21 -15
- package/mvnw/pom.xml +13 -4
- package/package.json +6 -6
- package/src/commands/clean.js +8 -2
- package/src/commands/java/dataize.js +5 -3
- package/src/commands/jeo/assemble.js +55 -0
- package/src/commands/jeo/disassemble.js +53 -0
- package/src/eoc.js +152 -90
- package/src/version.js +2 -2
- package/home-hash.txt +0 -1
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ Then, you write a simple [EO](https://www.eolang.org) program in `hello.eo` file
|
|
|
21
21
|
in the current directory:
|
|
22
22
|
|
|
23
23
|
```eo
|
|
24
|
+
# My first object in EO!
|
|
24
25
|
[args] > hello
|
|
25
26
|
QQ.io.stdout > @
|
|
26
27
|
"Hello, world!\n"
|
|
@@ -39,24 +40,30 @@ That's it.
|
|
|
39
40
|
You can also do many other things with `eoc` commands
|
|
40
41
|
(the flow is explained in [this blog post][blog]):
|
|
41
42
|
|
|
42
|
-
* `register` finds necessary
|
|
43
|
-
* `assemble` parses
|
|
43
|
+
* `register` finds necessary `.eo` files and registers them in a JSON catalog
|
|
44
|
+
* `assemble` parses `.eo` files into `.xmir`, optimizes them,
|
|
44
45
|
and pulls foreign EO objects
|
|
45
|
-
* `transpile` converts
|
|
46
|
-
|
|
46
|
+
* `transpile` converts `.xmir` files to the target programming
|
|
47
|
+
language (Java by default)
|
|
48
|
+
* `compile` converts target language sources (e.g., `.java`)
|
|
49
|
+
to binaries (e.g., `.class`)
|
|
47
50
|
* `link` puts all binaries together into a single executable binary
|
|
48
51
|
* `dataize` dataizes a single object from the executable binary
|
|
49
52
|
* `test` dataizes all visible unit tests
|
|
53
|
+
* `jeo:disassemble` converts Java `.class` files to `.xmir`
|
|
54
|
+
(via [jeo](https://github.com/objectionary/jeo-maven-plugin))
|
|
55
|
+
* `jeo:assemble` converts `.xmir` files to Java `.class` files
|
|
56
|
+
(via [jeo](https://github.com/objectionary/jeo-maven-plugin))
|
|
50
57
|
|
|
51
58
|
There are also commands that help manipulate with XMIR and EO sources
|
|
52
59
|
(the list is not completed, while some of them are not implemented as of yet):
|
|
53
60
|
|
|
54
61
|
* `audit` inspects all required packages and reports their status
|
|
55
|
-
* `foreign` inspects all objects found in the program after `assemble` step
|
|
56
|
-
* `sodg` generates
|
|
57
|
-
* `phi` generates
|
|
58
|
-
* `unphi` generates
|
|
59
|
-
* `print` generates
|
|
62
|
+
* `foreign` inspects all objects found in the program after the `assemble` step
|
|
63
|
+
* `sodg` generates `.sodg` from `.xmir`, further rederable as XML or [Dot][dot]
|
|
64
|
+
* `phi` generates `.phi` files from `.xmir` files
|
|
65
|
+
* `unphi` generates `.xmir` files from `.phi` files
|
|
66
|
+
* `print` generates `.eo` files from `.phi` files
|
|
60
67
|
* ~~`translate` converts Java/C++/Python/etc. program to EO program~~
|
|
61
68
|
* ~~`demu` removes `cage` and `memory` objects~~
|
|
62
69
|
* ~~`dejump` removes `goto` objects~~
|
package/eo-version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.40.3
|
package/home-tag.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
55e56e3bb2bdfa3d3e8e139028115790e820f0c1
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
#
|
|
2
|
-
# or more contributor license agreements. See the NOTICE file
|
|
3
|
-
# distributed with this work for additional information
|
|
4
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
5
|
-
# to you under the Apache License, Version 2.0 (the
|
|
6
|
-
# "License"); you may not use this file except in compliance
|
|
7
|
-
# with the License. You may obtain a copy of the License at
|
|
1
|
+
# The MIT License (MIT)
|
|
8
2
|
#
|
|
9
|
-
#
|
|
3
|
+
# Copyright (c) 2022-2024 Objectionary.com
|
|
10
4
|
#
|
|
11
|
-
#
|
|
12
|
-
# software
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included
|
|
13
|
+
# in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
# SOFTWARE.
|
|
22
|
+
|
|
23
|
+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
|
package/mvnw/pom.xml
CHANGED
|
@@ -29,6 +29,7 @@ SOFTWARE.
|
|
|
29
29
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
30
30
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
31
31
|
<eo.version>undefined</eo.version>
|
|
32
|
+
<jeo.version>0.6.12</jeo.version>
|
|
32
33
|
</properties>
|
|
33
34
|
<dependencies>
|
|
34
35
|
<dependency>
|
|
@@ -39,12 +40,12 @@ SOFTWARE.
|
|
|
39
40
|
<dependency>
|
|
40
41
|
<groupId>org.junit.jupiter</groupId>
|
|
41
42
|
<artifactId>junit-jupiter-api</artifactId>
|
|
42
|
-
<version>5.
|
|
43
|
+
<version>5.11.3</version>
|
|
43
44
|
</dependency>
|
|
44
45
|
<dependency>
|
|
45
46
|
<groupId>org.junit.jupiter</groupId>
|
|
46
47
|
<artifactId>junit-jupiter-engine</artifactId>
|
|
47
|
-
<version>5.
|
|
48
|
+
<version>5.11.3</version>
|
|
48
49
|
</dependency>
|
|
49
50
|
</dependencies>
|
|
50
51
|
<build>
|
|
@@ -66,6 +67,14 @@ SOFTWARE.
|
|
|
66
67
|
<foreignFormat>json</foreignFormat>
|
|
67
68
|
</configuration>
|
|
68
69
|
</plugin>
|
|
70
|
+
<plugin>
|
|
71
|
+
<groupId>org.eolang</groupId>
|
|
72
|
+
<artifactId>jeo-maven-plugin</artifactId>
|
|
73
|
+
<version>${jeo.version}</version>
|
|
74
|
+
<configuration>
|
|
75
|
+
<skipVerification>true</skipVerification>
|
|
76
|
+
</configuration>
|
|
77
|
+
</plugin>
|
|
69
78
|
<plugin>
|
|
70
79
|
<artifactId>maven-compiler-plugin</artifactId>
|
|
71
80
|
<version>3.8.1</version>
|
|
@@ -76,7 +85,7 @@ SOFTWARE.
|
|
|
76
85
|
</plugin>
|
|
77
86
|
<plugin>
|
|
78
87
|
<artifactId>maven-jar-plugin</artifactId>
|
|
79
|
-
<version>3.4.
|
|
88
|
+
<version>3.4.2</version>
|
|
80
89
|
<configuration>
|
|
81
90
|
<archive>
|
|
82
91
|
<manifest>
|
|
@@ -87,7 +96,7 @@ SOFTWARE.
|
|
|
87
96
|
</plugin>
|
|
88
97
|
<plugin>
|
|
89
98
|
<artifactId>maven-surefire-plugin</artifactId>
|
|
90
|
-
<version>3.
|
|
99
|
+
<version>3.5.1</version>
|
|
91
100
|
<configuration>
|
|
92
101
|
<failIfNoTests>true</failIfNoTests>
|
|
93
102
|
</configuration>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eolang",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"author": "Yegor Bugayenko <yegor256@gmail.com> (https://www.yegor256.com/)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "objectionary/eoc",
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
"colors": "1.4.0",
|
|
34
34
|
"commander": "12.1.0",
|
|
35
35
|
"eo2js": "0.0.7",
|
|
36
|
-
"fast-xml-parser": "4.
|
|
37
|
-
"node": "
|
|
36
|
+
"fast-xml-parser": "4.5.0",
|
|
37
|
+
"node": "23.1.0",
|
|
38
38
|
"relative": "3.0.2",
|
|
39
|
-
"semver": "7.6.
|
|
39
|
+
"semver": "7.6.3",
|
|
40
40
|
"sync-request": "6.1.0",
|
|
41
41
|
"xmlhttprequest": "1.8.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"eslint": "9.
|
|
44
|
+
"eslint": "9.13.0",
|
|
45
45
|
"eslint-config-google": "0.14.0",
|
|
46
46
|
"grunt": "1.6.1",
|
|
47
47
|
"grunt-contrib-clean": "2.0.1",
|
|
48
48
|
"grunt-eslint": "24.3.0",
|
|
49
49
|
"grunt-mocha-cli": "^7.0.0",
|
|
50
|
-
"mocha": "^10.
|
|
50
|
+
"mocha": "^10.8.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"test": "mocha --timeout 1200000"
|
package/src/commands/clean.js
CHANGED
|
@@ -34,12 +34,18 @@ const os = require('os');
|
|
|
34
34
|
module.exports = function(opts) {
|
|
35
35
|
const home = path.resolve(opts.target);
|
|
36
36
|
fs.rmSync(home, {recursive: true, force: true});
|
|
37
|
-
|
|
37
|
+
if (fs.existsSync(home)) {
|
|
38
|
+
console.info('The directory %s deleted', rel(home));
|
|
39
|
+
} else {
|
|
40
|
+
console.info('The directory %s doesn\'t exist, no need to delete', rel(home));
|
|
41
|
+
}
|
|
38
42
|
if (opts.global) {
|
|
39
43
|
const eo = path.join(os.homedir(), '.eo');
|
|
40
44
|
if (fs.existsSync(eo)) {
|
|
41
45
|
fs.rmSync(eo, {recursive: true});
|
|
42
|
-
console.info('The directory %s
|
|
46
|
+
console.info('The directory %s deleted', eo);
|
|
47
|
+
} else {
|
|
48
|
+
console.info('The directory %s doesn\'t exist, no need to delete', eo);
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
};
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const {spawn} = require('node:child_process');
|
|
26
25
|
const path = require('path');
|
|
26
|
+
const {spawn} = require('node:child_process');
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Runs the single executable binary.
|
|
@@ -35,14 +35,16 @@ module.exports = function(obj, args, opts) {
|
|
|
35
35
|
const params = [
|
|
36
36
|
'-Dfile.encoding=UTF-8',
|
|
37
37
|
`-Xss${opts.stack}`,
|
|
38
|
+
`-Xms${opts.heap}`,
|
|
38
39
|
'-jar', path.resolve(opts.target, 'eoc.jar'),
|
|
40
|
+
opts.verbose ? '--verbose' : '',
|
|
39
41
|
obj,
|
|
40
42
|
...args,
|
|
41
|
-
];
|
|
43
|
+
].filter((i) => i);
|
|
42
44
|
console.debug('+ java ' + params.join(' '));
|
|
43
45
|
spawn('java', params, {stdio: 'inherit'}).on('close', (code) => {
|
|
44
46
|
if (code !== 0) {
|
|
45
|
-
console.error(`
|
|
47
|
+
console.error(`JVM failed with exit code #${code}`);
|
|
46
48
|
process.exit(1);
|
|
47
49
|
}
|
|
48
50
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022-2024 Objectionary.com
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included
|
|
14
|
+
* in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const rel = require('relative');
|
|
26
|
+
const {mvnw, flags} = require('../../mvnw');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Assemble .xmir files from .class files.
|
|
31
|
+
* @param {Object} opts - All options
|
|
32
|
+
* @return {Promise} of assemble task
|
|
33
|
+
*/
|
|
34
|
+
module.exports = function(opts) {
|
|
35
|
+
return mvnw(
|
|
36
|
+
['jeo:unroll-phi', 'jeo:assemble']
|
|
37
|
+
.concat(flags(opts))
|
|
38
|
+
.concat(
|
|
39
|
+
[
|
|
40
|
+
`-Djeo.version=${opts.jeoVersion}`,
|
|
41
|
+
`-Djeo.unroll-phi.sourcesDir=${path.resolve(opts.target, opts.xmirs)}`,
|
|
42
|
+
`-Djeo.unroll-phi.outputDir=${path.resolve(opts.target, opts.unrolled)}`,
|
|
43
|
+
`-Djeo.assemble.sourcesDir=${path.resolve(opts.target, opts.unrolled)}`,
|
|
44
|
+
`-Djeo.assemble.outputDir=${path.resolve(opts.target, opts.classes)}`,
|
|
45
|
+
]
|
|
46
|
+
),
|
|
47
|
+
opts.target, opts.batch
|
|
48
|
+
).then((r) => {
|
|
49
|
+
console.info(
|
|
50
|
+
'EO .xmir files from %s assembled to .class to %s',
|
|
51
|
+
rel(opts.xmirs), rel(opts.classes)
|
|
52
|
+
);
|
|
53
|
+
return r;
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022-2024 Objectionary.com
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included
|
|
14
|
+
* in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const rel = require('relative');
|
|
26
|
+
const {mvnw, flags} = require('../../mvnw');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Disassemble .class files to .xmir files.
|
|
31
|
+
* @param {Object} opts - All options
|
|
32
|
+
* @return {Promise} of disassemble task
|
|
33
|
+
*/
|
|
34
|
+
module.exports = function(opts) {
|
|
35
|
+
return mvnw(
|
|
36
|
+
['jeo:disassemble']
|
|
37
|
+
.concat(flags(opts))
|
|
38
|
+
.concat(
|
|
39
|
+
[
|
|
40
|
+
`-Djeo.version=${opts.jeoVersion}`,
|
|
41
|
+
`-Djeo.disassemble.sourcesDir=${path.resolve(opts.target, opts.classes)}`,
|
|
42
|
+
`-Djeo.disassemble.outputDir=${path.resolve(opts.target, opts.xmirs)}`,
|
|
43
|
+
]
|
|
44
|
+
),
|
|
45
|
+
opts.target, opts.batch
|
|
46
|
+
).then((r) => {
|
|
47
|
+
console.info(
|
|
48
|
+
'Bytecode .class files from %s disassembled to .xmir to %s',
|
|
49
|
+
rel(opts.classes), rel(opts.xmirs)
|
|
50
|
+
);
|
|
51
|
+
return r;
|
|
52
|
+
});
|
|
53
|
+
};
|
package/src/eoc.js
CHANGED
|
@@ -23,19 +23,8 @@
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
const {program} = require('commander');
|
|
27
26
|
const tinted = require('./tinted-console');
|
|
28
|
-
const
|
|
29
|
-
const clean = require('./commands/clean');
|
|
30
|
-
const parse = require('./commands/parse');
|
|
31
|
-
const assemble = require('./commands/assemble');
|
|
32
|
-
const sodg = require('./commands/sodg');
|
|
33
|
-
const phi = require('./commands/phi');
|
|
34
|
-
const unphi = require('./commands/unphi');
|
|
35
|
-
const print = require('./commands/print');
|
|
36
|
-
const register = require('./commands/register');
|
|
37
|
-
const verify = require('./commands/verify');
|
|
38
|
-
const foreign = require('./commands/foreign');
|
|
27
|
+
const {program} = require('commander');
|
|
39
28
|
|
|
40
29
|
/**
|
|
41
30
|
* Target language option.
|
|
@@ -48,20 +37,41 @@ const language = {
|
|
|
48
37
|
/**
|
|
49
38
|
* Platform dependent commands.
|
|
50
39
|
*/
|
|
40
|
+
const common = {
|
|
41
|
+
assemble: require('./commands/assemble'),
|
|
42
|
+
audit: require('./commands/audit'),
|
|
43
|
+
clean: require('./commands/clean'),
|
|
44
|
+
foreign: require('./commands/foreign'),
|
|
45
|
+
parse: require('./commands/parse'),
|
|
46
|
+
phi: require('./commands/phi'),
|
|
47
|
+
print: require('./commands/print'),
|
|
48
|
+
register: require('./commands/register'),
|
|
49
|
+
sodg: require('./commands/sodg'),
|
|
50
|
+
unphi: require('./commands/unphi'),
|
|
51
|
+
verify: require('./commands/verify'),
|
|
52
|
+
jeo_disassemble: require('./commands/jeo/disassemble'),
|
|
53
|
+
jeo_assemble: require('./commands/jeo/assemble')
|
|
54
|
+
};
|
|
51
55
|
const commands = {
|
|
52
56
|
[language.java]: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
...common,
|
|
58
|
+
...{
|
|
59
|
+
transpile: require('./commands/java/transpile'),
|
|
60
|
+
link: require('./commands/java/link'),
|
|
61
|
+
compile: require('./commands/java/compile'),
|
|
62
|
+
dataize: require('./commands/java/dataize'),
|
|
63
|
+
test: require('./commands/java/test')
|
|
64
|
+
}
|
|
58
65
|
},
|
|
59
66
|
[language.js]: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
...common,
|
|
68
|
+
...{
|
|
69
|
+
transpile: require('./commands/js/transpile'),
|
|
70
|
+
link: require('./commands/js/link'),
|
|
71
|
+
compile: require('./commands/js/compile'),
|
|
72
|
+
dataize: require('./commands/js/dataize'),
|
|
73
|
+
test: require('./commands/js/test')
|
|
74
|
+
}
|
|
65
75
|
}
|
|
66
76
|
};
|
|
67
77
|
|
|
@@ -72,7 +82,7 @@ if (process.argv.includes('--verbose')) {
|
|
|
72
82
|
|
|
73
83
|
const fs = require('fs');
|
|
74
84
|
const path = require('path');
|
|
75
|
-
const
|
|
85
|
+
const tag = fs.readFileSync(path.join(__dirname, '../home-tag.txt'), 'utf8').trim();
|
|
76
86
|
let parser = fs.readFileSync(path.join(__dirname, '../eo-version.txt'), 'utf8').trim();
|
|
77
87
|
if (process.argv.includes('--latest')) {
|
|
78
88
|
parser = require('./parser-version').get();
|
|
@@ -88,7 +98,11 @@ program
|
|
|
88
98
|
.name('eoc')
|
|
89
99
|
.usage('[options] command')
|
|
90
100
|
.summary('EO command line toolkit')
|
|
91
|
-
.description(
|
|
101
|
+
.description(
|
|
102
|
+
'EO command-line toolkit (' +
|
|
103
|
+
version.what + ' built on ' + version.when +
|
|
104
|
+
'): https://github.com/objectionary/eoc'
|
|
105
|
+
)
|
|
92
106
|
.version(version.what, '-v, --version', 'Output the version number')
|
|
93
107
|
.helpOption('-?, --help', 'Print this help information')
|
|
94
108
|
.configureHelp({sortOptions: true, sortSubcommands: true});
|
|
@@ -96,7 +110,7 @@ program
|
|
|
96
110
|
program
|
|
97
111
|
.option('-s, --sources <path>', 'Directory with .EO sources', '.')
|
|
98
112
|
.option('-t, --target <path>', 'Directory with all generated files', '.eoc')
|
|
99
|
-
.option('--home-tag <version>', 'Git tag in objectionary/home to compile against',
|
|
113
|
+
.option('--home-tag <version>', 'Git tag in objectionary/home to compile against', tag)
|
|
100
114
|
.option('--parser <version>', 'Set the version of EO parser to use', parser)
|
|
101
115
|
.option('--latest', 'Use the latest parser version from Maven Central')
|
|
102
116
|
.option('--alone', 'Just run a single command without dependencies')
|
|
@@ -111,13 +125,13 @@ program
|
|
|
111
125
|
program.command('audit')
|
|
112
126
|
.description('Inspect all packages and report their status')
|
|
113
127
|
.action((str, opts) => {
|
|
114
|
-
audit(program.opts());
|
|
128
|
+
coms().audit(program.opts());
|
|
115
129
|
});
|
|
116
130
|
|
|
117
131
|
program.command('foreign')
|
|
118
132
|
.description('Inspect and print the list of foreign objects')
|
|
119
133
|
.action((str, opts) => {
|
|
120
|
-
foreign(program.opts());
|
|
134
|
+
coms().foreign(program.opts());
|
|
121
135
|
});
|
|
122
136
|
|
|
123
137
|
program
|
|
@@ -125,13 +139,13 @@ program
|
|
|
125
139
|
.option('--global', 'delete ~/.eo directory')
|
|
126
140
|
.description('Delete all temporary files')
|
|
127
141
|
.action((str, opts) => {
|
|
128
|
-
clean({...program.opts(), ...str});
|
|
142
|
+
coms().clean({...program.opts(), ...str});
|
|
129
143
|
});
|
|
130
144
|
|
|
131
145
|
program.command('register')
|
|
132
146
|
.description('Register all visible EO source files')
|
|
133
147
|
.action((str, opts) => {
|
|
134
|
-
register(program.opts());
|
|
148
|
+
coms().register(program.opts());
|
|
135
149
|
});
|
|
136
150
|
|
|
137
151
|
program.command('parse')
|
|
@@ -139,10 +153,10 @@ program.command('parse')
|
|
|
139
153
|
.action((str, opts) => {
|
|
140
154
|
clear(str);
|
|
141
155
|
if (program.opts().alone == undefined) {
|
|
142
|
-
register(program.opts())
|
|
143
|
-
.then((r) => parse(program.opts()));
|
|
156
|
+
coms().register(program.opts())
|
|
157
|
+
.then((r) => coms().parse(program.opts()));
|
|
144
158
|
} else {
|
|
145
|
-
parse(program.opts());
|
|
159
|
+
coms().parse(program.opts());
|
|
146
160
|
}
|
|
147
161
|
});
|
|
148
162
|
|
|
@@ -151,10 +165,10 @@ program.command('assemble')
|
|
|
151
165
|
.action((str, opts) => {
|
|
152
166
|
clear(str);
|
|
153
167
|
if (program.opts().alone == undefined) {
|
|
154
|
-
register(program.opts())
|
|
155
|
-
.then((r) => assemble(program.opts()));
|
|
168
|
+
coms().register(program.opts())
|
|
169
|
+
.then((r) => coms().assemble(program.opts()));
|
|
156
170
|
} else {
|
|
157
|
-
assemble(program.opts());
|
|
171
|
+
coms().assemble(program.opts());
|
|
158
172
|
}
|
|
159
173
|
});
|
|
160
174
|
|
|
@@ -169,11 +183,11 @@ program.command('sodg')
|
|
|
169
183
|
.action((str, opts) => {
|
|
170
184
|
clear(str);
|
|
171
185
|
if (program.opts().alone == undefined) {
|
|
172
|
-
register(program.opts())
|
|
173
|
-
.then((r) => assemble(program.opts()))
|
|
174
|
-
.then((r) => sodg({...program.opts(), ...str}));
|
|
186
|
+
coms().register(program.opts())
|
|
187
|
+
.then((r) => coms().assemble(program.opts()))
|
|
188
|
+
.then((r) => coms().sodg({...program.opts(), ...str}));
|
|
175
189
|
} else {
|
|
176
|
-
sodg({...program.opts(), ...str});
|
|
190
|
+
coms().sodg({...program.opts(), ...str});
|
|
177
191
|
}
|
|
178
192
|
});
|
|
179
193
|
|
|
@@ -192,11 +206,11 @@ program.command('phi')
|
|
|
192
206
|
.action((str, opts) => {
|
|
193
207
|
clear(str);
|
|
194
208
|
if (program.opts().alone == undefined) {
|
|
195
|
-
register(program.opts())
|
|
196
|
-
.then((r) => assemble(program.opts()))
|
|
197
|
-
.then((r) => phi({...program.opts(), ...str}));
|
|
209
|
+
coms().register(program.opts())
|
|
210
|
+
.then((r) => coms().assemble(program.opts()))
|
|
211
|
+
.then((r) => coms().phi({...program.opts(), ...str}));
|
|
198
212
|
} else {
|
|
199
|
-
phi(program.opts());
|
|
213
|
+
coms().phi({...program.opts(), ...str});
|
|
200
214
|
}
|
|
201
215
|
});
|
|
202
216
|
|
|
@@ -215,7 +229,7 @@ program.command('unphi')
|
|
|
215
229
|
.description('Generate XMIR files from PHI files')
|
|
216
230
|
.action((str, opts) => {
|
|
217
231
|
clear(str);
|
|
218
|
-
unphi({...program.opts(), ...str});
|
|
232
|
+
coms().unphi({...program.opts(), ...str});
|
|
219
233
|
});
|
|
220
234
|
|
|
221
235
|
program.command('print')
|
|
@@ -232,7 +246,7 @@ program.command('print')
|
|
|
232
246
|
)
|
|
233
247
|
.action((str, opts) => {
|
|
234
248
|
clear(str);
|
|
235
|
-
print({...program.opts(), ...str});
|
|
249
|
+
coms().print({...program.opts(), ...str});
|
|
236
250
|
});
|
|
237
251
|
|
|
238
252
|
program.command('verify')
|
|
@@ -240,11 +254,11 @@ program.command('verify')
|
|
|
240
254
|
.action((str, opts) => {
|
|
241
255
|
clear(str);
|
|
242
256
|
if (program.opts().alone == undefined) {
|
|
243
|
-
register(program.opts())
|
|
244
|
-
.then((r) => assemble(program.opts()))
|
|
245
|
-
.then((r) => verify(program.opts()));
|
|
257
|
+
coms().register(program.opts())
|
|
258
|
+
.then((r) => coms().assemble(program.opts()))
|
|
259
|
+
.then((r) => coms().verify(program.opts()));
|
|
246
260
|
} else {
|
|
247
|
-
verify(program.opts());
|
|
261
|
+
coms().verify(program.opts());
|
|
248
262
|
}
|
|
249
263
|
});
|
|
250
264
|
|
|
@@ -252,30 +266,28 @@ program.command('transpile')
|
|
|
252
266
|
.description('Convert EO files into target language')
|
|
253
267
|
.action((str, opts) => {
|
|
254
268
|
clear(str);
|
|
255
|
-
const lang = program.opts().language;
|
|
256
269
|
if (program.opts().alone == undefined) {
|
|
257
|
-
register(program.opts())
|
|
258
|
-
.then((r) => assemble(program.opts()))
|
|
259
|
-
.then((r) => verify(program.opts()))
|
|
260
|
-
.then((r) =>
|
|
270
|
+
coms().register(program.opts())
|
|
271
|
+
.then((r) => coms().assemble(program.opts()))
|
|
272
|
+
.then((r) => coms().verify(program.opts()))
|
|
273
|
+
.then((r) => coms().transpile(program.opts()));
|
|
261
274
|
} else {
|
|
262
|
-
|
|
275
|
+
coms().transpile(program.opts());
|
|
263
276
|
}
|
|
264
277
|
});
|
|
265
278
|
|
|
266
279
|
program.command('compile')
|
|
267
280
|
.description('Compile target language sources into binaries')
|
|
268
281
|
.action((str, opts) => {
|
|
269
|
-
const lang = program.opts().language;
|
|
270
282
|
clear(str);
|
|
271
283
|
if (program.opts().alone == undefined) {
|
|
272
|
-
register(program.opts())
|
|
273
|
-
.then((r) => assemble(program.opts()))
|
|
274
|
-
.then((r) => verify(program.opts()))
|
|
275
|
-
.then((r) =>
|
|
276
|
-
.then((r) =>
|
|
284
|
+
coms().register(program.opts())
|
|
285
|
+
.then((r) => coms().assemble(program.opts()))
|
|
286
|
+
.then((r) => coms().verify(program.opts()))
|
|
287
|
+
.then((r) => coms().transpile(program.opts()))
|
|
288
|
+
.then((r) => coms().compile(program.opts()));
|
|
277
289
|
} else {
|
|
278
|
-
|
|
290
|
+
coms().compile(program.opts());
|
|
279
291
|
}
|
|
280
292
|
});
|
|
281
293
|
|
|
@@ -283,37 +295,36 @@ program.command('link')
|
|
|
283
295
|
.description('Link together all binaries into a single executable binary')
|
|
284
296
|
.action((str, opts) => {
|
|
285
297
|
clear(str);
|
|
286
|
-
const lang = program.opts().language;
|
|
287
298
|
if (program.opts().alone == undefined) {
|
|
288
|
-
register(program.opts())
|
|
289
|
-
.then((r) => assemble(program.opts()))
|
|
290
|
-
.then((r) => verify(program.opts()))
|
|
291
|
-
.then((r) =>
|
|
292
|
-
.then((r) =>
|
|
293
|
-
.then((r) =>
|
|
299
|
+
coms().register(program.opts())
|
|
300
|
+
.then((r) => coms().assemble(program.opts()))
|
|
301
|
+
.then((r) => coms().verify(program.opts()))
|
|
302
|
+
.then((r) => coms().transpile(program.opts()))
|
|
303
|
+
.then((r) => coms().compile(program.opts()))
|
|
304
|
+
.then((r) => coms().link(program.opts()));
|
|
294
305
|
} else {
|
|
295
|
-
|
|
306
|
+
coms().link(program.opts());
|
|
296
307
|
}
|
|
297
308
|
});
|
|
298
309
|
|
|
299
310
|
program.command('dataize')
|
|
300
311
|
.description('Run the single executable binary and dataize an object')
|
|
301
|
-
.option('--stack <size>', '
|
|
312
|
+
.option('--stack <size>', 'Set stack size for the virtual machine', '1M')
|
|
313
|
+
.option('--heap <size>', 'Set the heap size for the VM', '256M')
|
|
302
314
|
.action((str, opts) => {
|
|
303
315
|
clear(str);
|
|
304
|
-
const lang = program.opts().language;
|
|
305
316
|
if (program.opts().alone == undefined) {
|
|
306
|
-
register(program.opts())
|
|
307
|
-
.then((r) => assemble(program.opts()))
|
|
308
|
-
.then((r) => verify(program.opts()))
|
|
309
|
-
.then((r) =>
|
|
310
|
-
.then((r) =>
|
|
311
|
-
.then((r) =>
|
|
312
|
-
.then((r) =>
|
|
317
|
+
coms().register(program.opts())
|
|
318
|
+
.then((r) => coms().assemble(program.opts()))
|
|
319
|
+
.then((r) => coms().verify(program.opts()))
|
|
320
|
+
.then((r) => coms().transpile(program.opts()))
|
|
321
|
+
.then((r) => coms().compile(program.opts()))
|
|
322
|
+
.then((r) => coms().link(program.opts()))
|
|
323
|
+
.then((r) => coms().dataize(
|
|
313
324
|
program.args[1], program.args.slice(2), {...program.opts(), ...str}
|
|
314
325
|
));
|
|
315
326
|
} else {
|
|
316
|
-
|
|
327
|
+
coms().dataize(
|
|
317
328
|
program.args[1], program.args.slice(2), {...program.opts(), ...str}
|
|
318
329
|
);
|
|
319
330
|
}
|
|
@@ -323,20 +334,58 @@ program.command('test')
|
|
|
323
334
|
.description('Run all visible unit tests')
|
|
324
335
|
.action((str, opts) => {
|
|
325
336
|
clear(str);
|
|
326
|
-
const lang = program.opts().language;
|
|
327
337
|
if (program.opts().alone == undefined) {
|
|
328
|
-
register(program.opts())
|
|
329
|
-
.then((r) => assemble(program.opts()))
|
|
330
|
-
.then((r) => verify(program.opts()))
|
|
331
|
-
.then((r) =>
|
|
332
|
-
.then((r) =>
|
|
333
|
-
.then((r) =>
|
|
334
|
-
.then((r) =>
|
|
338
|
+
coms().register(program.opts())
|
|
339
|
+
.then((r) => coms().assemble(program.opts()))
|
|
340
|
+
.then((r) => coms().verify(program.opts()))
|
|
341
|
+
.then((r) => coms().transpile(program.opts()))
|
|
342
|
+
.then((r) => coms().compile(program.opts()))
|
|
343
|
+
.then((r) => coms().link(program.opts()))
|
|
344
|
+
.then((r) => coms().test(program.opts()));
|
|
335
345
|
} else {
|
|
336
|
-
|
|
346
|
+
coms().test(program.opts());
|
|
337
347
|
}
|
|
338
348
|
});
|
|
339
349
|
|
|
350
|
+
program.command('jeo:disassemble')
|
|
351
|
+
.description('Disassemble .class files to .xmir files')
|
|
352
|
+
.option('--jeo-version <version>', 'Version of JEO to use', '0.6.11')
|
|
353
|
+
.option(
|
|
354
|
+
'--classes <dir>',
|
|
355
|
+
'Directory with .class files (relative to --target)',
|
|
356
|
+
'classes'
|
|
357
|
+
)
|
|
358
|
+
.option(
|
|
359
|
+
'--xmirs <dir>',
|
|
360
|
+
'Directory with .xmir files (relative to --target)',
|
|
361
|
+
'xmir'
|
|
362
|
+
)
|
|
363
|
+
.action((str, opts) => {
|
|
364
|
+
coms().jeo_disassemble({...program.opts(), ...str});
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
program.command('jeo:assemble')
|
|
368
|
+
.description('Assemble .xmir files to .class files')
|
|
369
|
+
.option('--jeo-version <version>', 'Version of JEO to use', '0.6.11')
|
|
370
|
+
.option(
|
|
371
|
+
'--xmirs <dir>',
|
|
372
|
+
'Directory with .xmir files (relative to --target)',
|
|
373
|
+
'xmir'
|
|
374
|
+
)
|
|
375
|
+
.option(
|
|
376
|
+
'--unrolled <dir>',
|
|
377
|
+
'Directory with unrolled .xmir files (relative to --target)',
|
|
378
|
+
'unrolled'
|
|
379
|
+
)
|
|
380
|
+
.option(
|
|
381
|
+
'--classes <dir>',
|
|
382
|
+
'Directory with .class files (relative to --target)',
|
|
383
|
+
'classes'
|
|
384
|
+
)
|
|
385
|
+
.action((str, opts) => {
|
|
386
|
+
coms().jeo_assemble({...program.opts(), ...str});
|
|
387
|
+
});
|
|
388
|
+
|
|
340
389
|
try {
|
|
341
390
|
program.parse(process.argv);
|
|
342
391
|
} catch (e) {
|
|
@@ -351,6 +400,19 @@ try {
|
|
|
351
400
|
*/
|
|
352
401
|
function clear(str) {
|
|
353
402
|
if (program.opts().clean) {
|
|
354
|
-
clean({...program.opts(), ...str});
|
|
403
|
+
coms().clean({...program.opts(), ...str});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Get commands for the target language.
|
|
409
|
+
* @return {Hash} Commands for the specified language
|
|
410
|
+
*/
|
|
411
|
+
function coms() {
|
|
412
|
+
const lang = program.opts().language;
|
|
413
|
+
const hash = commands[lang];
|
|
414
|
+
if (hash == undefined) {
|
|
415
|
+
throw new Error(`Unknown platform ${lang}`);
|
|
355
416
|
}
|
|
417
|
+
return hash;
|
|
356
418
|
}
|
package/src/version.js
CHANGED
package/home-hash.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
130afdd1456a0cbafd52aee8d7bc612e1faac547
|