forked from Rust-related/RustPython
readme and example change
This commit is contained in:
20
README.md
20
README.md
@@ -3,14 +3,14 @@ A Python Interpreter written in Rust :snake: :scream: :metal:.
|
||||
|
||||
[](https://travis-ci.org/RustPython/RustPython)
|
||||
|
||||
# Usage (Not implemented yet)
|
||||
# Usage
|
||||
|
||||
To test RustPython, do the following:
|
||||
|
||||
$ git clone https://github.com/RustPython/RustPython
|
||||
$ cd RustPython
|
||||
$ cargo run demo.py
|
||||
42
|
||||
Hello, RustPython!
|
||||
|
||||
Or use the interactive shell:
|
||||
|
||||
@@ -19,9 +19,9 @@ Or use the interactive shell:
|
||||
>>>>> 2+2
|
||||
4
|
||||
|
||||
Or use pip to install extra modules:
|
||||
<!-- Or use pip to install extra modules:
|
||||
|
||||
$ cargo run -m pip install requests
|
||||
$ cargo run -m pip install requests -->
|
||||
|
||||
# Goals
|
||||
|
||||
@@ -30,12 +30,12 @@ Or use pip to install extra modules:
|
||||
|
||||
# Code organization
|
||||
|
||||
- `parser`: python lexing, parsing and ast
|
||||
- `vm`: python virtual machine
|
||||
- `src`: using the other subcrates to bring rustpython to life.
|
||||
- `docs`: documentation (work in progress)
|
||||
- `py_code_object`: CPython bytecode to rustpython bytecode convertor (work in progress)
|
||||
- `tests`: integration test snippets
|
||||
- parser: python lexing, parsing and ast
|
||||
- vm: python virtual machine
|
||||
- src: using the other subcrates to bring rustpython to life.
|
||||
- docs: documentation (work in progress)
|
||||
- py_code_object: CPython bytecode to rustpython bytecode convertor (work in progress)
|
||||
- tests: integration test snippets
|
||||
|
||||
# Community
|
||||
|
||||
|
||||
64
vm/README.md
64
vm/README.md
@@ -1,64 +0,0 @@
|
||||
RustPython
|
||||
==============
|
||||
|
||||
A Python interpreter written in Rust
|
||||
|
||||
# Installation
|
||||
|
||||
```
|
||||
bash init_env.sh
|
||||
```
|
||||
|
||||
# Run
|
||||
|
||||
```
|
||||
./test.sh <path/to/file.py> # compile and run
|
||||
./test.sh <path/to/file.py> --bytecode # print the bytecode in JSON
|
||||
./test.sh <path/to/file.py> --dis # Run python -m dis
|
||||
```
|
||||
|
||||
## Manual
|
||||
Given a python file `test.py`
|
||||
|
||||
```
|
||||
python compile_code.py test.py > test.bytecode
|
||||
|
||||
cd RustPython
|
||||
cargo run ../test.bytecode
|
||||
```
|
||||
|
||||
# Testing & debugging
|
||||
|
||||
```
|
||||
./test_all.sh # Run all tests under tests/
|
||||
```
|
||||
|
||||
* If a test is expected to fail or raise exception, add `xfail_*` prefix to the filename.
|
||||
|
||||
## Logging
|
||||
|
||||
```
|
||||
RUST_LOG=debug ./tests_all.sh
|
||||
```
|
||||
|
||||
# TODOs
|
||||
* Native types => Partial
|
||||
* Control flow => if(v)
|
||||
* assert => OK
|
||||
* Structural types (list, tuple, object)
|
||||
* Strings
|
||||
* Function calls => Blocked by bytecode serializer
|
||||
* Modules import
|
||||
* Generators
|
||||
|
||||
|
||||
# Goals
|
||||
* Support all builtin functions
|
||||
* Runs the [pybenchmark](https://pybenchmarks.org/) benchmark test
|
||||
* Run famous/popular python modules (which?)
|
||||
|
||||
* Compatible with CPython 3.6
|
||||
|
||||
# Rust version
|
||||
rustc 1.20.0-nightly
|
||||
|
||||
Reference in New Issue
Block a user