David Mak
140f8f8a08
core: Implement most ndarray-creation functions
2023-12-22 16:29:55 +08:00
David Mak
27fcf8926e
core: Implement ndarray constructor and numpy.empty
2023-12-22 16:29:54 +08:00
David Mak
afa7d9b100
core: Implement helper for creation of generic ndarray
2023-12-21 15:39:49 +08:00
David Mak
c395472094
core: Initial infrastructure for ndarray
2023-12-21 15:39:46 +08:00
David Mak
03870f222d
core: Extract special method handling in type inferencer
...
To prepare for more special handling with methods.
2023-12-21 15:38:26 +08:00
David Mak
e435b25756
core: Allow implicit promotions of integral literals
...
It should not matter, since it is the value of the literal that matters
with respect to the const generic variable.
2023-12-21 15:21:08 +08:00
David Mak
bd792904f9
core: Add size_t to primitive store
...
Used for ndims in ndarray.
2023-12-21 15:20:31 +08:00
David Mak
1c3a823670
core: Do not discard value names for IRRT
2023-12-20 15:16:02 +08:00
David Mak
f01d833d48
standalone: Add missing parenthesis
2023-12-20 15:15:47 +08:00
David Mak
9d64e606f4
core: Reject multiple literal bounds
...
This is currently broken due to how we handle function calls in the
unifier.
2023-12-18 10:04:25 +08:00
David Mak
6dccb343bb
Revert "core: Do not keep unification result for function arguments"
...
This reverts commit f09f3c27a5
.
2023-12-18 10:01:23 +08:00
Sebastien Bourdeauducq
d47534e2ad
interpret_demo: add typing.Literal
2023-12-18 08:50:49 +08:00
David Mak
8886964776
core: Remove redundant argument in type annotation parsing
2023-12-16 18:40:48 +08:00
David Mak
f09f3c27a5
core: Do not keep unification result for function arguments
...
For some reason, when unifying a function call parameter with an
argument, subsequent calls to the same function will only accept the
type of the substituted argument.
This affect snippets like:
```
def make1() -> C[Literal[1]]:
return ...
def make2() -> C[Literal[2]]:
return ...
def consume(instance: C[Literal[1, 2]]):
pass
consume(make1())
consume(make2())
```
The last statement will result in a compiler error, as the parameter of
consume is replaced with C[Literal[1]].
We fix this by getting a snapshot before performing unification, and
restoring the snapshot after unification succeeds.
2023-12-16 18:40:48 +08:00
David Mak
0bbc9ce6f5
core: Deduplicate values in `Literal`
...
Matches the behavior with `typing.Literal`.
2023-12-16 18:40:48 +08:00
David Mak
457d3b6cd7
core: Refactor generic constants to `Literal`
...
Better matches the syntax of `typing.Literal`.
2023-12-16 18:40:48 +08:00
David Mak
5f692debd8
core: Add PrimitiveStore into Unifier
...
This will be used during unification between a const generic variable
and a `Literal`.
2023-12-16 18:40:48 +08:00
David Mak
c7735d935b
standalone: Output id of undefined identifier
2023-12-16 18:40:48 +08:00
David Mak
b47ac1b89b
core: Minor formatting cleanup
2023-12-15 17:46:44 +08:00
David Mak
a19f1065e3
meta: Refactor to use more let-else bindings
2023-12-12 16:31:14 +08:00
Sebastien Bourdeauducq
5bf05c6a69
update ARTIQ version used for PGO profiling
2023-12-12 15:57:48 +08:00
David Mak
32746c37be
core: Refactor to return errors by HashSet
2023-12-12 15:41:59 +08:00
David Mak
1d6291b9ba
ast: Add Ord implementation to Location
2023-12-12 15:41:59 +08:00
David Mak
16655959f2
meta: Update cargo dependencies
2023-12-12 15:41:59 +08:00
David Mak
beee3e1f7e
artiq: Pass artiq builtins to NAC3 constructor
2023-12-12 11:28:03 +08:00
David Mak
d4c109b6ef
core: Add missing generic constant concrete type
2023-12-12 11:28:01 +08:00
David Mak
5ffd06dd61
core: Remove debugging statement
2023-12-12 11:23:51 +08:00
David Mak
95d0c3c93c
artiq: Rename const_generic_dummy to const_generic_marker
2023-12-12 11:23:51 +08:00
David Mak
bd3d67f3d6
artiq: Apply clippy pedantic changes
2023-12-11 15:16:23 +08:00
David Mak
ddfb532b80
standalone: Apply clippy pedantic changes
2023-12-11 15:16:23 +08:00
David Mak
02933753ca
core: Apply clippy pedantic changes
2023-12-11 15:16:23 +08:00
David Mak
a1f244834f
meta: Bringup some documentation
2023-12-11 15:16:23 +08:00
David Mak
d304afd333
meta: Apply clippy suggested changes
2023-12-11 15:16:23 +08:00
David Mak
ef04696b02
meta: Lift return out of conditional statement
2023-12-11 15:16:23 +08:00
David Mak
4dc5dbb856
meta: Replace equality assertion with assert_eq
...
Emits a more useful assertion message.
2023-12-11 15:16:23 +08:00
David Mak
fd9f66b8d9
meta: Remove redundant casts and brackets
2023-12-11 15:16:23 +08:00
David Mak
5182453bd9
meta: Remove redundant path prefixes
2023-12-11 15:16:23 +08:00
Sebastien Bourdeauducq
68556da5fd
update ARTIQ version used for PGO profiling
2023-12-11 09:37:03 +08:00
David Mak
983f080ea7
artiq: Implement handling for const generic variables
2023-12-08 18:02:14 +08:00
David Mak
031e660f18
core: Initial implementation for const generics
2023-12-08 18:02:11 +08:00
David Mak
b6dfcfcc38
core: Move some SymbolValue functions to symbol_resolver.rs
2023-12-08 18:00:51 +08:00
David Mak
c93ad152d7
core: Codegen for ellipsis expression as NotImplemented
...
A lot of refactoring was performed, specifically with relaxing
expression codegen to return Option in case where ellipsis are used
within a subexpression.
2023-12-08 18:00:51 +08:00
David Mak
68b97347b1
core: Infer builtins name list using builtin declaration list
2023-12-08 17:29:34 +08:00
David Mak
875d534de4
ast: Use `{filename}:{row}:{col}` for location output
2023-12-08 15:48:54 +08:00
Sebastien Bourdeauducq
adadf56e2b
nac3standalone: generate PIC
2023-12-04 19:09:50 +08:00
Sebastien Bourdeauducq
9f610745b7
cargo: update dependencies
2023-12-04 18:51:06 +08:00
Sebastien Bourdeauducq
98199768e3
demo: fix 64-bit format strings
2023-12-04 18:51:06 +08:00
Sebastien Bourdeauducq
bfa9ceaae3
switch to new nixpkgs release
2023-12-03 10:31:05 +08:00
Sebastien Bourdeauducq
120f8da5c7
fix compilation warnings
2023-11-26 09:09:24 +08:00
Sebastien Bourdeauducq
cee62aa6c5
pin down LLVM used for IRRT
2023-11-25 20:15:29 +08:00