mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Move bytecode into own crate.
This commit is contained in:
1 parent
f0492eefb2
commit
183415e64b
12 files changed
+37
-6
No files matched your search
Generated
+14
@@ -918,6 +918,17 @@ dependencies = [
|
||||
"xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustpython_bytecode"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-complex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustpython_parser 0.0.1",
|
||||
"serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustpython_compiler"
|
||||
version = "0.1.0"
|
||||
@@ -926,6 +937,7 @@ dependencies = [
|
||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-complex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustpython_bytecode 0.1.0",
|
||||
"rustpython_parser 0.0.1",
|
||||
"serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -938,6 +950,7 @@ dependencies = [
|
||||
"proc-macro-hack 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustpython_bytecode 0.1.0",
|
||||
"rustpython_compiler 0.1.0",
|
||||
"syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -984,6 +997,7 @@ dependencies = [
|
||||
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version_runtime 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustpython_bytecode 0.1.0",
|
||||
"rustpython_compiler 0.1.0",
|
||||
"rustpython_derive 0.1.0",
|
||||
"rustpython_parser 0.0.1",
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
[package]
|
||||
name = "rustpython"
|
||||
version = "0.0.1"
|
||||
authors = ["Windel Bouwman", "Shing Lyu <shing.lyu@gmail.com>"]
|
||||
authors = ["Windel Bouwman <windel@windel.nl>", "Shing Lyu <shing.lyu@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[workspace]
|
||||
members = [".", "derive", "vm", "wasm/lib", "parser", "compiler"]
|
||||
members = [".", "derive", "vm", "wasm/lib", "parser", "compiler", "bytecode"]
|
||||
|
||||
[[bench]]
|
||||
name = "bench"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "rustpython_bytecode"
|
||||
version = "0.1.0"
|
||||
authors = ["Windel Bouwman <windel@windel.nl>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.1"
|
||||
num-bigint = { version = "0.2", features = ["serde"] }
|
||||
num-complex = { version = "0.2", features = ["serde"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
rustpython_parser = { path = "../parser" }
|
||||
File renamed without changes.
@@ -0,0 +1 @@
|
||||
pub mod bytecode;
|
||||
+2
-1
@@ -1,11 +1,12 @@
|
||||
[package]
|
||||
name = "rustpython_compiler"
|
||||
version = "0.1.0"
|
||||
authors = ["coolreader18 <33094578+coolreader18@users.noreply.github.com>"]
|
||||
authors = ["coolreader18 <33094578+coolreader18@users.noreply.github.com>", "Windel Bouwman <windel@windel.nl>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.1"
|
||||
rustpython_bytecode = { path = "../bytecode" }
|
||||
rustpython_parser = { path = "../parser" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
num-complex = { version = "0.2", features = ["serde"] }
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
//! https://github.com/python/cpython/blob/master/Python/compile.c
|
||||
//! https://github.com/micropython/micropython/blob/master/py/compile.c
|
||||
|
||||
use crate::bytecode::{self, CallType, CodeObject, Instruction, Varargs};
|
||||
use crate::error::{CompileError, CompileErrorType};
|
||||
use crate::symboltable::{make_symbol_table, statements_to_symbol_table, SymbolRole, SymbolScope};
|
||||
use num_complex::Complex64;
|
||||
use rustpython_bytecode::bytecode::{self, CallType, CodeObject, Instruction, Varargs};
|
||||
use rustpython_parser::{ast, parser};
|
||||
|
||||
struct Compiler {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
pub mod bytecode;
|
||||
pub mod compile;
|
||||
pub mod error;
|
||||
mod symboltable;
|
||||
@@ -12,5 +12,6 @@ syn = { version = "0.15.29", features = ["full"] }
|
||||
quote = "0.6.11"
|
||||
proc-macro2 = "0.4.27"
|
||||
rustpython_compiler = { path = "../compiler" }
|
||||
rustpython_bytecode = { path = "../bytecode" }
|
||||
bincode = "1.1"
|
||||
proc-macro-hack = "0.5"
|
||||
@@ -17,7 +17,8 @@ use crate::{extract_spans, Diagnostic};
|
||||
use bincode;
|
||||
use proc_macro2::{Span, TokenStream as TokenStream2};
|
||||
use quote::quote;
|
||||
use rustpython_compiler::{bytecode::CodeObject, compile};
|
||||
use rustpython_bytecode::bytecode::CodeObject;
|
||||
use rustpython_compiler::compile;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@@ -15,6 +15,7 @@ log = "0.3"
|
||||
rustpython_derive = {path = "../derive"}
|
||||
rustpython_parser = {path = "../parser"}
|
||||
rustpython_compiler = {path = "../compiler"}
|
||||
rustpython_bytecode = { path = "../bytecode" }
|
||||
serde = { version = "1.0.66", features = ["derive"] }
|
||||
serde_json = "1.0.26"
|
||||
byteorder = "1.2.6"
|
||||
|
||||
@@ -65,6 +65,7 @@ mod vm;
|
||||
// pub use self::pyobject::Executor;
|
||||
pub use self::exceptions::print_exception;
|
||||
pub use self::vm::VirtualMachine;
|
||||
pub use rustpython_bytecode::*;
|
||||
pub use rustpython_compiler::*;
|
||||
|
||||
#[doc(hidden)]
|
||||
|
||||
Reference in new issue
Block a user