readme and example change

This commit is contained in:
rmliddle
2018-09-23 16:25:48 +10:00
parent d438ddcdfd
commit c9fdc68937
5 changed files with 11 additions and 76 deletions

View File

@@ -3,14 +3,14 @@ A Python Interpreter written in Rust :snake: :scream: :metal:.
[![Build Status](https://travis-ci.org/RustPython/RustPython.svg?branch=master)](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

View File

@@ -1,2 +1,2 @@
print(42)
print("Hello, RustPython!")

View File

@@ -1 +0,0 @@
print(2 + 3)

View File

@@ -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