David Mak
bb27e3d400
standalone: Fix indentation of demo.c
2023-11-01 13:20:26 +08:00
David Mak
bb5147521f
standalone: Fix indentation of test files
2023-11-01 13:20:26 +08:00
David Mak
a50c690428
standalone: Fix run_demo script
...
- Link main and module*.bc together if using multiple threads
- Fix temporary files not being deleted
2023-10-16 15:52:48 +08:00
David Mak
c7de22287e
core: Fix restoration of stack address
...
All allocas for temporary objects are now placed in the beginning of the
function. Allocas for on-temporary objects are not modified because
these variables may appear in a loop and thus must be uniquely
represented.
2023-10-06 11:34:23 +08:00
David Mak
c5629d4eb5
standalone: Remove redundant const in demo library
2023-10-06 10:32:58 +08:00
David Mak
a79286113e
standalone: Add output_bool in demo library
2023-10-06 10:19:22 +08:00
David Mak
f34c6053d6
standalone: Add flags to control demo output options
2023-10-04 18:11:44 +08:00
David Mak
e8a5f0dfef
standalone: Fix parsing NAC3 args in check_demo.sh
2023-10-04 18:03:28 +08:00
David Mak
7140901261
standalone: Fix missing libraries when linking
...
Fixes `undefined reference to 'pow'` for pow.py using -O0.
2023-10-04 18:03:28 +08:00
David Mak
2a775d822e
core: Demote dead code into a stdout warning
2023-10-04 18:03:25 +08:00
David Mak
1659c3e724
standalone: Remove temporary logfiles after execution
2023-09-30 09:31:18 +08:00
David Mak
f53cb804ec
standalone: Add execution of test cases via lli
2023-09-30 09:31:18 +08:00
David Mak
b6afd1bfda
standalone: Split check_demos into check_demo
...
Allows individual tests to be executed.
2023-09-30 09:31:18 +08:00
David Mak
be3e8f50a2
standalone: Refactor demo library to C
...
Needed for use by lli.
2023-09-30 09:31:18 +08:00
David Mak
059d3da58b
standalone: Add float64 output tests
2023-09-30 09:31:18 +08:00
David Mak
48c6498d1f
core: Fix restoration of loop target in try statement
...
old_loop_target is only assigned if ctx.loop_target is overwritten,
meaning that if ctx.loop_target is never overwritten, ctx.loop_target
will always be overwritten to None.
We fix this by only restoring from old_loop_target if we previously
assigned to old_loop_target.
2023-09-28 20:00:02 +08:00
David Mak
b39831b388
standalone: Update demos
...
- Add `output_str` for printing a string
- Add demo_test.py to test interop
2023-09-28 19:58:53 +08:00
David Mak
31dcd2dde9
core: Use i8 for boolean variable allocation
...
In LLVM, i1 represents a 1-byte integer with a single valid bit; The
rest of the 7 upper bits are undefined. This causes problems when
using these variables in memory operations (e.g. memcpy/memmove as
needed by List slicing and assignment).
We fix this by treating all local boolean variables as i8 so that they
are well-defined for memory operations. Function ABIs will continue to
use i1, as memory operations cannot be directly performed on function
arguments or return types, instead they are always converted back into
local boolean variables (which are i8s anyways).
Fixes #315 .
2023-09-25 15:42:07 +08:00
David Mak
769fd01df8
meta: Allow specifying compiler arguments for check_demos
2023-09-18 11:35:20 +08:00
David Mak
008d50995c
meta: Update run_demo.sh
...
- Allow more than one argument to nac3standalone executable
2023-09-12 16:20:50 +08:00
David Mak
4481d48709
core: Use C-style for loop logic for iterables
...
Index increment is now performed at the end of the loop body.
2023-09-06 20:09:38 +08:00
David Mak
e0de82993f
core: Preserve value of variable shadowed by for loop
...
Previously, the final value of the target expression would be one after
the last element of the loop, which does not match Python's behavior.
This commit fixes this problem while also preserving the last assigned
value of the loop beyond the loop, matching Python's behavior.
2023-09-06 20:09:36 +08:00
David Mak
17b4686260
standalone: Adapt loop example to output loop variable
2023-09-06 18:56:45 +08:00
ychenfo
8addf2b55e
nac3standalone: add more tests
2022-06-01 17:58:16 +08:00
ychenfo
44199781dc
nac3standalone: add tests for operators
2022-04-18 15:31:56 +08:00
ychenfo
86ce513cb5
nac3standalone: fix broken test
...
previously this test unexpectedly passed because it is a slice assignment to extend the list, which is valid in CPython and hence in interpret_demo, and which also happened to give the same output in nac3 by memmove the elements in the list of bool
2022-04-05 18:21:46 +08:00
ychenfo
23b7f4ef18
nac3standalone: add tests for power
2022-04-04 22:10:56 +08:00
ychenfo
b8ef44d64e
nac3standalone: add test for default param
2022-03-30 04:05:47 +08:00
ychenfo
bed33a7421
nac3standalone: add tests for tuple
2022-03-27 10:31:20 +08:00
Sebastien Bourdeauducq
e4581a6d9b
nac3standalone/demo: fix return type in loop.py
2022-03-26 21:10:12 +08:00
pca006132
1a82d296e7
nac3core/codegen: prevent users from modifying loop counter
...
Fixes #211
2022-03-26 20:58:37 +08:00
ychenfo
80631fc92b
Option type support ( #224 )
...
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2022-03-26 15:09:15 +08:00
Sebastien Bourdeauducq
3f890f183c
nac3standalone/demo: handle imports consistently
2022-03-19 09:14:27 +08:00
pca006132
234823c51a
nac3standalone: added typevar test
2022-03-18 16:52:52 +08:00
ychenfo
60b3807ab3
nac3standalone: add test for abs function
2022-03-08 23:26:01 +08:00
ychenfo
1cc276cb43
nac3standalone: add test for max function
2022-03-08 22:23:13 +08:00
ychenfo
e9a17cf8f8
nac3standalone: add test for min function
2022-03-08 21:59:42 +08:00
Sebastien Bourdeauducq
aa79c8d8b7
rename exception symbols in host code
2022-02-23 11:43:41 +08:00
pca006132
f97f93d92c
applied rustfmt and clippy auto fix
2022-02-21 18:27:46 +08:00
Sebastien Bourdeauducq
91f41052fe
test: remove outdated comment
2022-02-13 17:24:47 +08:00
pca006132
14d25b3b9d
Fixed broken tests
2022-02-13 17:21:42 +08:00
Sebastien Bourdeauducq
4b8e70f746
nac3standalone: disable broken tests ( #188 )
2022-02-13 11:41:42 +08:00
Sebastien Bourdeauducq
31e76ca3b6
nac3standalone: add dummy support for artiq_personality
...
So existing tests can run again
2022-02-13 11:35:02 +08:00
ychenfo
43048eb8d8
nac3standalone: add tests for list slice and len
2022-01-26 03:58:27 +08:00
Sebastien Bourdeauducq
ced7acd871
check_demos: improve output
2022-01-24 11:38:43 +08:00
Sebastien Bourdeauducq
f8e3f7a4ca
add some basic list tests
2022-01-23 14:28:08 +08:00
Sebastien Bourdeauducq
ba997ae094
flake: run nac3standalone demo checks
...
also keep auxiliary projects in separate Nix outputs
2022-01-23 11:32:34 +08:00
Sebastien Bourdeauducq
2a0caf931f
nac3standalone: work around bash mess with exit codes of substituted processes
...
https://unix.stackexchange.com/questions/376114/how-to-detect-an-error-using-process-substitution
2022-01-23 11:15:11 +08:00
Sebastien Bourdeauducq
64b94955fe
nac3standalone: reorganize demos, compare against cpython
2022-01-23 10:35:06 +08:00
Sebastien Bourdeauducq
096193f7ab
demo: rewrite in Rust
2022-01-09 10:51:10 +08:00