porffor 0.0.0-745e995 → 0.0.0-7d5ae9c
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 +49 -15
- package/c +0 -0
- package/c.exe +0 -0
- package/compiler/2c.js +350 -0
- package/compiler/builtins.js +6 -1
- package/compiler/codeGen.js +639 -186
- package/compiler/decompile.js +3 -3
- package/compiler/embedding.js +9 -5
- package/compiler/encoding.js +4 -2
- package/compiler/index.js +55 -4
- package/compiler/opt.js +49 -23
- package/compiler/parse.js +1 -0
- package/compiler/prototype.js +172 -34
- package/compiler/sections.js +47 -6
- package/compiler/wrap.js +19 -1
- package/cool.exe +0 -0
- package/g +0 -0
- package/g.exe +0 -0
- package/hi.c +37 -0
- package/out +0 -0
- package/out.exe +0 -0
- package/package.json +1 -1
- package/r.js +39 -0
- package/rhemyn/README.md +37 -0
- package/rhemyn/compile.js +214 -0
- package/rhemyn/parse.js +321 -0
- package/rhemyn/test/parse.js +59 -0
- package/runner/index.js +54 -33
- package/runner/info.js +37 -2
- package/runner/repl.js +6 -11
- package/runner/transform.js +5 -26
- package/runner/version.js +10 -0
- package/t.js +31 -0
- package/tmp.c +58 -0
package/tmp.c
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#ifdef _WIN32
|
2
|
+
#include <windows.h>
|
3
|
+
#else
|
4
|
+
#include <time.h>
|
5
|
+
#endif
|
6
|
+
|
7
|
+
#include <stdio.h>
|
8
|
+
|
9
|
+
double aux(double n, double acc1, double acc2) {
|
10
|
+
if (n == 0e+0) {
|
11
|
+
return acc1;
|
12
|
+
}
|
13
|
+
if (n == 1e+0) {
|
14
|
+
return acc2;
|
15
|
+
}
|
16
|
+
return aux(n - 1e+0, acc2, acc1 + acc2);
|
17
|
+
}
|
18
|
+
|
19
|
+
double fib(double n) {
|
20
|
+
return aux(n, 0e+0, 1e+0);
|
21
|
+
}
|
22
|
+
|
23
|
+
double test(double n, double count) {
|
24
|
+
double res = 0;
|
25
|
+
double i = 0;
|
26
|
+
|
27
|
+
i = 0e+0;
|
28
|
+
while (i < count) {
|
29
|
+
res = fib(n);
|
30
|
+
i = i + 1e+0;
|
31
|
+
}
|
32
|
+
return res;
|
33
|
+
}
|
34
|
+
|
35
|
+
double inline __performance_now() {
|
36
|
+
double _time_out;
|
37
|
+
#ifdef _WIN32
|
38
|
+
LARGE_INTEGER _time_freq, _time_t;
|
39
|
+
QueryPerformanceFrequency(&_time_freq);
|
40
|
+
QueryPerformanceCounter(&_time_t);
|
41
|
+
_time_out = ((double)_time_t.QuadPart / _time_freq.QuadPart) * 1000.;
|
42
|
+
#else
|
43
|
+
struct timespec _time;
|
44
|
+
clock_gettime(CLOCK_MONOTONIC, &_time);
|
45
|
+
_time_out = _time.tv_nsec / 1000000.;
|
46
|
+
#endif
|
47
|
+
return _time_out;
|
48
|
+
}
|
49
|
+
|
50
|
+
int main() {
|
51
|
+
double t = 0;
|
52
|
+
|
53
|
+
t = __performance_now();
|
54
|
+
// Sleep(1000);
|
55
|
+
printf("%f\n", test(4.6e+1, 1e+7));
|
56
|
+
printf("%f\n", (__performance_now() - t));
|
57
|
+
}
|
58
|
+
|