PP UP, Python3.10
This commit is contained in:
parent
8f8f79d799
commit
ac8daf74f5
2
Makefile
2
Makefile
@ -34,7 +34,7 @@ typecheck: venv/.done
|
|||||||
venv/bin/mypy --strict phasm tests/integration/runners.py
|
venv/bin/mypy --strict phasm tests/integration/runners.py
|
||||||
|
|
||||||
venv/.done: requirements.txt
|
venv/.done: requirements.txt
|
||||||
python3.8 -m venv venv
|
python3.10 -m venv venv
|
||||||
venv/bin/python3 -m pip install wheel pip --upgrade
|
venv/bin/python3 -m pip install wheel pip --upgrade
|
||||||
venv/bin/python3 -m pip install -r $^
|
venv/bin/python3 -m pip install -r $^
|
||||||
touch $@
|
touch $@
|
||||||
|
|||||||
@ -12,7 +12,7 @@ This is a hobby project for now. Use at your own risk.
|
|||||||
|
|
||||||
How to run
|
How to run
|
||||||
----------
|
----------
|
||||||
You should only need make and python3. Currently, we're working with python3.8,
|
You should only need make and python3. Currently, we're working with python3.10,
|
||||||
since we're using the python ast parser, it might not work on other versions.
|
since we're using the python ast parser, it might not work on other versions.
|
||||||
|
|
||||||
To run the examples:
|
To run the examples:
|
||||||
@ -32,7 +32,7 @@ make lint typecheck
|
|||||||
|
|
||||||
To compile a Phasm file:
|
To compile a Phasm file:
|
||||||
```sh
|
```sh
|
||||||
python3.8 -m phasm source.py output.wat
|
python3.10 -m phasm source.py output.wat
|
||||||
```
|
```
|
||||||
|
|
||||||
Additional required tools
|
Additional required tools
|
||||||
|
|||||||
@ -539,7 +539,7 @@ class OurVisitor:
|
|||||||
if not isinstance(node.value, ast.Name):
|
if not isinstance(node.value, ast.Name):
|
||||||
_raise_static_error(node, 'Must reference a name')
|
_raise_static_error(node, 'Must reference a name')
|
||||||
|
|
||||||
if not isinstance(node.slice, ast.Index):
|
if isinstance(node.slice, ast.Slice):
|
||||||
_raise_static_error(node, 'Must subscript using an index')
|
_raise_static_error(node, 'Must subscript using an index')
|
||||||
|
|
||||||
if not isinstance(node.ctx, ast.Load):
|
if not isinstance(node.ctx, ast.Load):
|
||||||
@ -556,7 +556,7 @@ class OurVisitor:
|
|||||||
_raise_static_error(node, f'Undefined variable {node.value.id}')
|
_raise_static_error(node, f'Undefined variable {node.value.id}')
|
||||||
|
|
||||||
slice_expr = self.visit_Module_FunctionDef_expr(
|
slice_expr = self.visit_Module_FunctionDef_expr(
|
||||||
module, function, our_locals, node.slice.value,
|
module, function, our_locals, node.slice,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Subscript(varref, slice_expr)
|
return Subscript(varref, slice_expr)
|
||||||
@ -593,11 +593,11 @@ class OurVisitor:
|
|||||||
if isinstance(node, ast.Subscript):
|
if isinstance(node, ast.Subscript):
|
||||||
if not isinstance(node.value, ast.Name):
|
if not isinstance(node.value, ast.Name):
|
||||||
_raise_static_error(node, 'Must be name')
|
_raise_static_error(node, 'Must be name')
|
||||||
if not isinstance(node.slice, ast.Index):
|
if isinstance(node.slice, ast.Slice):
|
||||||
_raise_static_error(node, 'Must subscript using an index') # FIXME: Do we use type level length?
|
_raise_static_error(node, 'Must subscript using an index') # FIXME: Do we use type level length?
|
||||||
if not isinstance(node.slice.value, ast.Constant):
|
if not isinstance(node.slice, ast.Constant):
|
||||||
_raise_static_error(node, 'Must subscript using a constant index')
|
_raise_static_error(node, 'Must subscript using a constant index')
|
||||||
if not isinstance(node.slice.value.value, int):
|
if not isinstance(node.slice.value, int):
|
||||||
_raise_static_error(node, 'Must subscript using a constant integer index')
|
_raise_static_error(node, 'Must subscript using a constant integer index')
|
||||||
if not isinstance(node.ctx, ast.Load):
|
if not isinstance(node.ctx, ast.Load):
|
||||||
_raise_static_error(node, 'Must be load context')
|
_raise_static_error(node, 'Must be load context')
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
mypy==0.812
|
mypy==0.991
|
||||||
pygments==2.12.0
|
pygments==2.12.0
|
||||||
pylint==2.7.4
|
pylint==2.15.9
|
||||||
pytest==6.2.2
|
pytest==7.2.0
|
||||||
pytest-integration==0.2.2
|
pytest-integration==0.2.2
|
||||||
pywasm==1.0.7
|
pywasm==1.0.7
|
||||||
pywasm3==0.5.0
|
pywasm3==0.5.0
|
||||||
wasmer==1.1.0
|
wasmer==1.1.0
|
||||||
wasmer_compiler_cranelift==1.1.0
|
wasmer_compiler_cranelift==1.1.0
|
||||||
wasmtime==0.36.0
|
wasmtime==3.0.0
|
||||||
|
|||||||
@ -162,7 +162,7 @@ class RunnerPywasm3(RunnerBase):
|
|||||||
memory = self.rtime.get_memory(0)
|
memory = self.rtime.get_memory(0)
|
||||||
|
|
||||||
for idx, byt in enumerate(data):
|
for idx, byt in enumerate(data):
|
||||||
memory[offset + idx] = byt # type: ignore
|
memory[offset + idx] = byt
|
||||||
|
|
||||||
def interpreter_read_memory(self, offset: int, length: int) -> bytes:
|
def interpreter_read_memory(self, offset: int, length: int) -> bytes:
|
||||||
memory = self.rtime.get_memory(0)
|
memory = self.rtime.get_memory(0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user