Giter Site home page Giter Site logo

nerdlang / nerd Goto Github PK

View Code? Open in Web Editor NEW
3.5K 3.5K 128.0 167.75 MB

🔱 Javascript's God Mode. No VM. No Bytecode. No GC. Just native binaries.

Home Page: https://nectarjs.com

License: MIT License

JavaScript 21.42% C++ 65.20% C 13.36% HTML 0.02%
arduino compilation js nodejs raspberry wasm

nerd's People

Contributors

0xflotus avatar adrien-thierry avatar ajitzero avatar arjndr avatar dependabot[bot] avatar despair86 avatar fwsgonzo avatar indios avatar krmax44 avatar libkakashi avatar lukaselmer avatar matbarre avatar moshfeu avatar mtvare6 avatar resynth1943 avatar saiv46 avatar threepointone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nerd's Issues

Some issues on the website

nectarjs.com seems to stutter when scrolling on Chrome or Brave and to a lesser extent on Edge. It's like it's fighting me to scroll the page down.

Also the e in development and developers in some places has a glyph on top of it. This is incorrect.

Finally, you're loading a Google font with HTTP and this is making Brave complain about mixed content. Just need to use the HTTPS version.

This is a great idea and I look forward to seeing in progress. I'll need this in a couple of years when I want to compile my JavaScript game for distribution.

Keep it up!

Unexpected Compilation Error, no info

I'm just returning "Unexpected Compilation Error". I fixed about 500 minor syntax errors/warnings, but now this is all I see without any further description. My target seems fine. The script isn't doing anything out of the ordinary: lots of arrays, some objects, and bit functions on 32-bit ints. Any ideas?

How to write a NectarJS program that accepts arguments?

I already have the question in stack overflow here, but shortly, i want to be able to give parameters when starting the compiled version of the program. For examle:
#compile the javascrpit code with nectar
nectar file.js --single -o compiledFile
#now i want to run it with a second argument witch is an input file
./compiledFile inputFile
Is there a built-in functionality or any sort of way i can do that, or can it be possible to be done since JavaScript itself doesn't support that sort of thing.

Combining NectarJS with React Native

Hi,

How feasible do you think that it would be to modify NectarJS to integrate it with React Native? If JS could be compiled to binary while making use of React to interact with the DOM one of the bottlenecks of React Native could be addressed.

Thanks!

Not ES6 Suport

Hello.
I receive "Compilation error" when I use let, async, await and others ES6 features.

Have some prediction to add suport for that?
Will be good specify this issue on readme?

Thanks.

GUIs

Is it or will it be possible to develop GUIs with nectarjs as opposed to using something like electron. If this question is unclear I can try to elaborate.

console.log(object) not supported? Code optimized out?

Compiled the following:

testObject.exe

var testObject = { testKey1: "test 1" };
testObject["testKey2"] = "test 2";
console.log(testObject);

testObject2.exe

console.log("test 0");
var testObject = { testKey1: "test 1" };
testObject["testKey2"] = "test 2";
console.log(testObject);
console.log("test 3");

testObjectKey.exe

var testObject = { testKey1: "test 1" };
testObject["testKey2"] = "test 2";
console.log(testObject["testKey1"]);

Their outputs look like this:
2018-01-03 09_00_39-win 10 dt on lt-01012252 - virtual machine connection

First, look at testObject2.exe. Strings "test 0" and "test 3" made it into the binary, but the others did not.
2018-01-03 08_28_32- cmd exe - radare2 result-win-x86-64 testobject2 exe - gvim

"test 0" and "test 3" are puts() by this, but code related to the object testObject is missing:
2018-01-03 08_31_23- cmd exe - radare2 result-win-x86-64 testobject2 exe - gvim

sub.test_0_540 is called here, mixed in with initialization code and exit which all NectarJS win-x86-64 targets seem to share (boilerplate? template?):
2018-01-03 08_33_13- cmd exe - radare2 result-win-x86-64 testobject2 exe - gvim

Now testObjectKey.exe. All related strings are present in the binary.
2018-01-03 08_56_55- cmd exe - radare2 result-win-x86-64 testobjectkey exe - gvim

Looks like code working with the object is here:
2018-01-03 08_57_14- cmd exe - radare2 result-win-x86-64 testobjectkey exe - gvim

Which is called here, with familiar boilerplate:
2018-01-03 08_57_55- cmd exe - radare2 result-win-x86-64 testobjectkey exe - gvim

Lastly, testObject.exe. All of the related strings are missing.
2018-01-03 08_34_30- cmd exe - radare2 result-win-x86-64 testobject exe - gvim

In the spot where I should find a call to the code which works with the object, I instead find a call to some code which has another call to fcn.00401f00. I stopped here and have not put any effort into understanding what fcn.00401f00 does since it, or an equivalent, appears to be called during initialization in any case (the cases I've looked at, anyway).
2018-01-03 08_38_16- cmd exe - radare2 result-win-x86-64 testobject exe - gvim
2018-01-03 08_45_36- cmd exe - radare2 result-win-x86-64 testobject exe - gvim

Basically, it looks like I ended up with an exe with nothing but boilerplate.

Is console.log(object) not yet supported? Or, did something go wrong during the build, the problem was handled gracefully, and the exe was generated anyway? Maybe it would be better for the build to fail.

Assuming the object and its supporting strings and code were optimized out because there are no useful references to it, where did the optimization occur? Your compiler, or by MinGW?

Error

shindin@shindin:~/myml/js2wasm$ nodejs example.js 
dlrow olleH
shindin@shindin:~/myml/js2wasm$ sudo nectar --run example.js 
Compilation error
shindin@shindin:~/myml/js2wasm$ cat example.js 
function r(s) {
  return s.split("").reverse().join("");
}
console.log(r('Hello world'));
shindin@shindin:~/myml/js2wasm$ sudo nectar --target wasm example.js
Compilation error
shindin@shindin:~/myml/js2wasm$ sudo nectar --run hello.js
Hello

shindin@shindin:~/myml/js2wasm$ sudo nectar --target wasm hello.js
shindin@shindin:~/myml/js2wasm$

This example.js does not compile.

win-x86-64 target executables still use Duktape

Issue #10 was closed with:

image

However, win-x86-64 target executables compiled since then still appear to use Duktape.

When I compile this:

console.log(Duktape.version)

It still outputs 20299.

.rdata section still contains strings related to duktape.

image

Has something gone wrong with the update?

/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found

I did

necater   --verbose  a.js

And i run ./a-linux-x86-64.bin

Here is the result:

./a-linux-x86-64.bin: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./a-linux-x86-64.bin)
./a-linux-x86-64.bin: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./a-linux-x86-64.bin)

I know it's not NectarJS's problem.But I can't fix it....... help....

Does it work on macos?

I am confused how to compile or run anything with NectarJS on macos 10.13.2 (17C88)…

# nectar -v
NectarJS Client v0.0.53

# nectar example.js
[!] Bad target

[*] Available targets :
-> win-x86-32
-> win-x86-64
-> linux-x86-32
-> linux-x86-64
-> linux-arm32v7
-> arduino-uno
-> arduino-mega1280
-> arduino-mega2560
-> wasm
-> wast
-> asm-js

# cat project.json
{"main": "example.js", "out": "example.asm.js", "target":"asm-js", "preset":"speed"}

# nectar --target asm-js example.js
Missing project.json

Note: I am using MacPorts, could this affect compilation?

# port select --summary
Name        Selected           Options
====        ========           =======
gcc         mp-gcc49           none
llvm        mp-llvm-3.5        none

FFI possibilities

Hi, I wonder if now or eventually Nectar could be used in the following way:

I defined a piece of JavaScript which depends on a platform API:

MessageBoxW(null, 'Hello, World!', 'Hi!', 0);

Then I somehow defined the FFI information so that Nectar knows this function I'm invoking is a part of the platform's/target's API.

And then I compile this code using Nectar and have a binary which invokes the Windows API MessageBoxW.

Also, this might be a better fit for a separate issue, but anyway: I see you are providing people with keys to access Nectar while it's in alpha and also this repo doesn't include any source code. How are you going to provide Nectar when it makes out of alpha? Is it going to be open source? Free or paid?

Unicode problem

I did not see unicode support listed in the roadmap, but I found this problem.

If I compile this:

var hovercraft_j = "私のホバークラフトは鰻でいっぱいです";
var hovercraft_g = "Το αερόστρωμνο μου ειναι γεμάτο χέλια";
var hovercraft_r = "Моё судно на воздушной подушке полно угрей";

console.log(hovercraft_j);
console.log(hovercraft_g);
console.log(hovercraft_r);

and run it on Windows with a terminal properly configured for unicode, I get this output:

image

Here is the same code executed by NodeJS:

image

Here I can see NectarJS is using fputs to try to output the unicode text:

image

If I compile this with MinGW:

#include <fcntl.h>
#include <io.h>
#include <stdio.h>

int main () {
	char *hovercraft_j = "\t私のホバークラフトは鰻でいっぱいです\n";
	wchar_t *hovercraftw_j = L"\t私のホバークラフトは鰻でいっぱいです\n";
	
	char *hovercraft_g = "\tΤο αερόστρωμνο μου ειναι γεμάτο χέλια\n";
	wchar_t *hovercraftw_g = L"\tΤο αερόστρωμνο μου ειναι γεμάτο χέλια\n";
	
	char *hovercraft_r = "\tМоё судно на воздушной подушке полно угрей\n";
	wchar_t *hovercraftw_r = L"\tМоё судно на воздушной подушке полно угрей\n";
	
	fputs("\nfputs()\n", stdout);
	
	fputs(hovercraft_j, stdout);
	fputs(hovercraft_g, stdout);
	fputs(hovercraft_r, stdout);
	
	fputs("\nfputws()\n", stdout);

	fputws(hovercraftw_j, stdout);
	fputws(hovercraftw_g, stdout);
	fputws(hovercraftw_r, stdout);
	
	fputs("\nfputws() with _setmode()\n", stdout);
	
	_setmode(_fileno(stdout), _O_U16TEXT);
	fputws(hovercraftw_j, stdout);
	fputws(hovercraftw_g, stdout);
	fputws(hovercraftw_r, stdout);
	
    return 0;
}

I get the following output:

image

Output consistent with NectarJS when using fputs. No output for fputws. And proper output when using fputws with _setmode.

Would it be possible to add a _setnode call and fputws or switch to WriteConsoleW (as I believe NodeJS uses) for Windows unicode output?

Unexpected network error

I am unable to compile the examples provided using the --example flag
$ nectar --verbose hello.js [!] Unexpected network error

Error: EISDIR: illegal operation on a directory

I'm getting this error when I want to compile my javascript. It happened after I added xml2js npm package

fs.js:119
    throw err;
    ^

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:498:3)
    at tryReadSync (fs.js:337:20)
    at Object.readFileSync (fs.js:374:19)```

Compiling JavaScript to C source code

Since NectarJS is able to compile JavaScript into WebAssembly, it may be possible to compile JavaScript into C source code using a compiler like wasmdec. Does NectarJS have this feature yet?

WebGL

Can we write WebGL apps with Nectar? I guess it needs JS glue with WebAssembly. Any plans?

Integer overflow and crash

I have two issues when compiling this with NectarJS and running it:

var x = 2147483647;
var y = 2147483648;

console.log(x);
console.log(y);
console.log(x+1);

I get the following output and a crash:

image

In other javascript engines

var y = 2147483648;
console.log(y);

outputs 2147483648

image

image

NectarJS, unless I'm reading this wrong, appears to store 2147483648 in a local variable as a 32 bit int (mov dword [rsp + 0x80], 0x80000000)

image

then outputs it later with fprintf using %ld.

image

When I compile this with MinGW:

#include <stdio.h>

int main () {
    int y = 2147483648;
    fprintf(stdout,"%ld\n%lu\n", y, y);
    return 0;
}

2147483648 is stored the same way (mov dword [local_4h], 0x80000000).

image

%ld has the same output as NectarJS, and %lu has the expected output.

image

Is this a matter of NectarJS incorrectly choosing %ld for fprintf in this case, or a big number support problem in general?

The crash is caused here (remember 2147483647 is sitting in local variable rsp + 0x60):

image

image

image

It looks like strlen is called on 2147483647 (0x7fffffff) and somehow results in strlen treating 0x7fffffff as an address. I don't understand why this happens yet, and I have not reproduced it in c or assembly so far. Bug?

nectar --example fails

NectarJS Client v0.0.46
Win8.1x64
node v8.9.0

nectar --example

Fails with error:

fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'D:\My\Dev\nectarjs-playground\example\arduino.js'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1291:33)
    at copyExample (C:\Users\Roman\AppData\Roaming\npm\node_modules\nectarjs\nectar.js:257:8)
    at Object.<anonymous> (C:\Users\Roman\AppData\Roaming\npm\node_modules\nectarjs\nectar.js:86:5)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)

Getting ERR_OUT_OF_RANGE error on any js file

It's just not working for me on Ubuntu (14.04.3 LTS). I'm getting this error when trying to run/build string.js that is generated by nectar --example

$ nectar string.js
internal/buffer.js:35
    throw new ERR_OUT_OF_RANGE('value', `>= ${min} and <= ${max}`, value);
    ^

RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 3653141014
    at checkInt (internal/buffer.js:35:11)
    at writeU_Int32LE (internal/buffer.js:515:3)
    at Buffer.writeInt32LE (internal/buffer.js:684:10)
    at Object.entryHeaderToBinary (/usr/local/lib/node_modules/nectarjs/extern/adm-zip/headers/entryHeader.js:216:18)
    at Object.packHeader (/usr/local/lib/node_modules/nectarjs/extern/adm-zip/zipEntry.js:260:39)
    at /usr/local/lib/node_modules/nectarjs/extern/adm-zip/zipFile.js:198:41
    at Array.forEach (<anonymous>)
    at Object.compressToBuffer (/usr/local/lib/node_modules/nectarjs/extern/adm-zip/zipFile.js:182:23)
    at Object.toBuffer (/usr/local/lib/node_modules/nectarjs/extern/adm-zip/adm-zip.js:488:25)
    at /usr/local/lib/node_modules/nectarjs/nectar.js:488:45

Compile as a library

Is it possible to compile a C library (a .a for example)?
The idea would be to replace duktape for calling a javascript function from another language.

Expose more 'Compilation error' info

When I run broken JS code, I just get Compilation error and that's it.
Good to know:

  1. What is file.
  2. What is the line.
  3. What is the column
  4. What is the reason (why it cannot be compiled: no support or invalid syntax, or any other)
  5. Stack trace

Make "Not Implemented Yet" message a compiler error

When I compile something like this with target win-x86-64:

function fibonacci(n)
{
if (n < 2)  return n;
return fibonacci(n - 2) + fibonacci(n - 1);
}
console.log("The number is " + fibonacci(50));

The compiler outputs an executable which appears to call msvcrt function

puts("Not implemented Yet");

and exits, without doing any work.

Would it make more sense for this to be a compiler error instead? Down the road it might be better for automated builds to fail rather than successfully produce executatables with unexpected behavior when a project pulls in code using unsupported language features. Tests could be built by developers to catch this situation, but things could get cumbersome very quickly.

Node suport

NectarJS Client v0.0.46
OS: Ubuntu Gnome 16.04
Node: v7.10.1

I try use node modules and doesn't work.

Example:
var koa = require('koa')
var app = new koa()

I just receive: Compilation error

Obs: I'm not using --single

[!] Network error : socket hang up

Trying to make some tests with nectar (master branch) and all I get in any combination is "[!] Network error : socket hang up"after waiting for a minute or so.
Any help?

Out of memory and crashes

This code will cause to run out of memory and crashes:

for (;;)
{
    var obj = { "aa":"bb" };
}

Generated C++:

for (;;)
{
	// FIXME: _N_42 needs to be shared_ptr
	vector<shared_ptr<pair<var, var>>> *_N_42 = new vector<shared_ptr<pair<var, var>>>();
	var obj = var(OBJECT, _N_42);
	__NJS_Object_Set((char*)"aa", __create_String((char *)"bb"), obj);
}

BTW, Have you considered using GC instead of shared_ptr?

[!] Unexpected network error

The short example code snippets work fine but on longer code I get [!] Unexpected network error. Perhaps there is a maximum length you support, or maybe the code is too complex.

Out of curiosity for whether it would work I used the Opal Ruby to JavaScript transpiler to transpile a short snippet of Ruby code which ends up being much longer JS code, but still a single ES5 file. Then I tried running that through Nectar.

nectar --target mac-osx hello.js --single

hello.js.zip

Why does javascript similar to my code exist in memory?

Compiled this:

var x = "xxx";
y = x;
z = y;
console.log(x + y + z);

Loaded into windbg and ran the following commands:

g
s -a 0 L?80000000/2 "xxx"

Saw something interesting at 0068d713, so dumped it.

d 0068d713-15 L50

2017-12-26 12_04_50-win 10 dt on lt-01012252 - virtual machine connection

Why does javascript similar to my code exist in memory?

attempt to apply fs.readFileSync to directory

Hi, i have a problem when trying to compile with any libraries in node_modules:

./node_moduleutil/README.md
node_modules\util\README.md

./node_moduleutil/support/isBuffer.js
node_modules\util\support\isBuffer.js

./node_moduleutil/support/isBufferBrowser.js
node_modules\util\support\isBufferBrowser.js

./node_moduleutil/util.js
node_modules\util\util.js

./node_module
node_modules\

fs.js:115
    throw err;
    ^

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:494:3)
    at tryReadSync (fs.js:333:20)
    at Object.readFileSync (fs.js:370:19)
    at C:\Users\sergei.dudko\AppData\Roaming\npm\node_modules\nectarjs\extern\adm-zip\adm-zip.js:276:38
    at Array.forEach ()
    at Object.addLocalFolder (C:\Users\sergei.dudko\AppData\Roaming\npm\node_modules\nectarjs\extern\adm-zip\adm-zip.js:269:12)
    at C:\Users\sergei.dudko\AppData\Roaming\npm\node_modules\nectarjs\nectar.js:499:17
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `nectar --target win-x86-64 -o ./iRetailUpdater.exe ./index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\sergei.dudko\AppData\Roaming\npm-cache\_logs\2019-08-13T16_06_16_216Z-debug.log

As far as I see the problem with the script nectarjs\extern\adm-zip\adm-zip.js in part:

if (filter(p)) {
	if (p.charAt(p.length - 1) !== "/") {
		console.log(zipPath + p)
		console.log(path)
		console.log()
		self.addFile(zipPath + p, fs.readFileSync(path), "", 0)
	} else {
		self.addFile(zipPath + p, Buffer.alloc(0), "", 0)
	}
}

You check that p is not a directory if (p.charAt(p.length - 1) !== "/") but use synchronous read to path fs.readFileSync(path). I believe that this is not true. And I tried to fix it:

if (filter(p)) {
	if (path.charAt(path.length - 1) !== "\\") {
		console.log(zipPath + p)
		console.log(path)
		console.log()
		self.addFile(zipPath + p, fs.readFileSync(path), "", 0)
	} else {
		self.addFile(zipPath + p, Buffer.alloc(0), "", 0)
	}
}

Now i get another error:

./node_moduleutil/util.js
node_modules\util\util.js

./package-lock.json
package-lock.json

./package.json
package.json

./project.json
project.json

[!] Signature error.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `nectar --target win-x86-64 -o ./iRetailUpdater.exe ./index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\sergei.dudko\AppData\Roaming\npm-cache\_logs\2019-08-13T16_14_11_071Z-debug.log

Windows 7 64bit
C:\nectar_test>node --version
v10.15.0
C:\nectar_test>npm --version
6.10.3

No dependencies in node_modules compilation succeeds

Dead link to register for an ID?

I'm confused as to how registering for an ID:

> sudo nectar --single hello.js
[!] Unkown id, please register on https://nectarjs.com and add your id in your client.

image

(Enhancement) >>> Not Implemented

When I try to compile my project, I receive the message

Expression : >>> - Not Implemented Yet in BinaryExpression

This is necessary for basically all uses I have for this, hopefully it can be implemented soon, or if someone could present a workaround to me that would be great. Until then, I'll be looking on my own for a workaround. Thanks!

How much will it cost?

Also what's the reason for not doing an open source model like Qt? (they seem to be successful with their commercial licenses)

Error

C:\Users\PC\Documents\dev code\Editor\sc>nectar test.js
fs.js:675
return binding.read(fd, buffer, offset, length, position);
^

Error: EISDIR: illegal operation on a directory, read
at Object.fs.readSync (fs.js:675:18)
at tryReadSync (fs.js:540:20)
at Object.fs.readFileSync (fs.js:583:19)
at C:\Users\PC\AppData\Roaming\npm\node_modules\nectarjs\extern\adm-zip\adm-zip.js:273:38
at Array.forEach ()
at Object.addLocalFolder (C:\Users\PC\AppData\Roaming\npm\node_modules\nectarjs\extern\adm-zip\adm-zip.js:269:12)
at C:\Users\PC\AppData\Roaming\npm\node_modules\nectarjs\nectar.js:499:17
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

C:\Users\PC\Documents\dev code\Editor\sc>nectar test.js
fs.js:675
return binding.read(fd, buffer, offset, length, position);
^

Error: EISDIR: illegal operation on a directory, read
at Object.fs.readSync (fs.js:675:18)
at tryReadSync (fs.js:540:20)
at Object.fs.readFileSync (fs.js:583:19)
at C:\Users\PC\AppData\Roaming\npm\node_modules\nectarjs\extern\adm-zip\adm-zip.js:273:38
at Array.forEach ()
at Object.addLocalFolder (C:\Users\PC\AppData\Roaming\npm\node_modules\nectarjs\extern\adm-zip\adm-zip.js:269:12)
at C:\Users\PC\AppData\Roaming\npm\node_modules\nectarjs\nectar.js:499:17
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

C:\Users\PC\Documents\dev code\Editor\sc>nectar test.js
fs.js:675
return binding.read(fd, buffer, offset, length, position);
^

I got this error
Error: EISDIR: illegal operation on a directory, read
at Object.fs.readSync (fs.js:675:18)
at tryReadSync (fs.js:540:20)
at Object.fs.readFileSync (fs.js:583:19)
at C:\Users\PC\AppData\Roaming\npm\node_modules\nectarjs\extern\adm-zip\adm-zip.js:273:38
at Array.forEach ()
at Object.addLocalFolder (C:\Users\PC\AppData\Roaming\npm\node_modules\nectarjs\extern\adm-zip\adm-zip.js:269:12)
at C:\Users\PC\AppData\Roaming\npm\node_modules\nectarjs\nectar.js:499:17
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

How do you deal with the need for type information?

Other projects that compile JavaScript (or JavaScript-like languages such as TypeScript) require the addition of types to your code in order to allow compilation.

Does NectarJS have the same requirement?

Or do you somehow infer types through static analysis?

Error 'Bad Target' for 'nectar project.json'.

The command "nectar project.json" generates the error "Bad Target". I read your code and found out that this happens only in computers with arch other than the few specified in your code. For example, my pc has ARCH 'ia32' which you haven't specified in your code.

Also, if the code is not automatically able to find a target, it generates the above error (without even checking if the target in specified in project.json or not.). It should first check for target in project.json and then generate error if it is not there.

nectar

Support for Python imports

A Python file with an import statement errors out due to a compilation failure.

You should look into this.

Miraclx.

Trying Local Compiling

I have begun to play around with local compiling and want to begin constructing examples and the errors they result in if they do not succeed. Here is my first try:

Code

The executed commands are:

cd node_modules/nectarjs
./nectarjs --compiler g++ ../../src/index.js

The error was:
error

I tried again by removing the arrow functions and using function syntax and the error persisted in the same form.

Arrow

No Arrow

(Different points in GIT history)

Unexpected Compilation Error with simple JSON function

This is my JS file, which results in "Unexpected Compilation Error":

function json_parse(json)
{
  return JSON.parse(json);
}
console.log(json_parse("{}"));

The only difference between this and a version that compiles is the introduction of the JSON object. Isn't that a built-in javascript object? Should this be expected to work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.