Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitccd1534

Browse files
committed
Merge branch 'master' into bojan/objobject-__and__-default
2 parentse7cd832 +c4cbeda commitccd1534

File tree

63 files changed

+2829
-895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2829
-895
lines changed

‎Cargo.lock‎

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎README.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ Or use the interactive shell:
2626
- Full Python-3 environment entirely in Rust (not CPython bindings)
2727
- A clean implementation without compatibility hacks
2828

29+
#Documentation
30+
31+
Currently the project is in an early phase, and so is the documentation.
32+
33+
You can generate documentation by running:
34+
35+
```shell
36+
$ cargo doc
37+
```
38+
39+
Documentation HTML files can then be found in the`target/doc` directory.
40+
2941
#Code organization
3042

3143
-`parser`: python lexing, parsing and ast
@@ -64,6 +76,24 @@ There also are some unittests, you can run those will cargo:
6476
$ cargotest --all
6577
```
6678

79+
#Using another standard library
80+
81+
As of now the standard library is under construction.
82+
83+
You can play around
84+
with other standard libraries for python. For example,
85+
the[ouroboros library](https://github.com/pybee/ouroboros).
86+
87+
To do this, follow this method:
88+
89+
```shell
90+
$cd~/GIT
91+
$ git clone git@github.com:pybee/ouroboros.git
92+
$export PYTHONPATH=~/GIT/ouroboros/ouroboros
93+
$cd RustPython
94+
$ cargo run -- -c'import statistics'
95+
```
96+
6797
#Compiling to WebAssembly
6898

6999
##Setup

‎parser/Cargo.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ lalrpop="0.15.1"
1111
lalrpop-util="0.15.1"
1212
log="0.4.1"
1313
regex="0.2.2"
14+
num-bigint ="0.2"
15+
num-traits ="0.2"
1416

‎parser/src/ast.rs‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
/*
2-
* Implement abstract syntax tree nodes for the python language.
3-
*/
1+
//! Implement abstract syntax tree nodes for the python language.
2+
//!
3+
//! Roughly equivalent to this: https://docs.python.org/3/library/ast.html
44
55
pubusesuper::lexer::Location;
6+
use num_bigint::BigInt;
67
/*
78
#[derive(Debug)]
89
@@ -40,6 +41,7 @@ pub struct Located<T> {
4041

4142
pubtypeLocatedStatement =Located<Statement>;
4243

44+
/// Abstract syntax tree nodes for python statements.
4345
#[derive(Debug,PartialEq)]
4446
pubenumStatement{
4547
Break,
@@ -70,6 +72,12 @@ pub enum Statement {
7072
Expression{
7173
expression:Expression,
7274
},
75+
Global{
76+
names:Vec<String>,
77+
},
78+
Nonlocal{
79+
names:Vec<String>,
80+
},
7381
If{
7482
test:Expression,
7583
body:Vec<LocatedStatement>,
@@ -191,6 +199,9 @@ pub enum Expression {
191199
String{
192200
value:String,
193201
},
202+
Bytes{
203+
value:Vec<u8>,
204+
},
194205
Identifier{
195206
name:String,
196207
},
@@ -275,8 +286,10 @@ pub enum BooleanOperator {
275286

276287
#[derive(Debug,PartialEq)]
277288
pubenumUnaryOperator{
289+
Pos,
278290
Neg,
279291
Not,
292+
Inv,
280293
}
281294

282295
#[derive(Debug,PartialEq)]
@@ -295,6 +308,7 @@ pub enum Comparison {
295308

296309
#[derive(Debug,PartialEq)]
297310
pubenumNumber{
298-
Integer{value:i32},
311+
Integer{value:BigInt},
299312
Float{value:f64},
313+
Complex{real:f64,imag:f64},
300314
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp