mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Remove unused compiler namespace in parser
This commit is contained in:
2
parser/.gitignore
vendored
2
parser/.gitignore
vendored
@@ -1,3 +1,3 @@
|
||||
src/compiler/python.rs
|
||||
src/python.rs
|
||||
target/
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// This file makes this directory a submodule.
|
||||
|
||||
mod parser;
|
||||
mod python;
|
||||
pub mod ast;
|
||||
mod token;
|
||||
mod lexer;
|
||||
// mod compile;
|
||||
// mod bytecode;
|
||||
mod builtins;
|
||||
mod pyobject;
|
||||
// mod vm;
|
||||
|
||||
pub use self::parser::parse;
|
||||
// pub use self::vm::evaluate;
|
||||
|
||||
|
||||
// Mimic eval code objects:
|
||||
//pub fn eval_code() -> pyobject::PyObjectRef {
|
||||
|
||||
//}
|
||||
@@ -1,4 +1,12 @@
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
pub mod compiler;
|
||||
mod parser;
|
||||
mod python;
|
||||
pub mod ast;
|
||||
mod token;
|
||||
mod lexer;
|
||||
// mod builtins;
|
||||
// mod pyobject;
|
||||
|
||||
pub use self::parser::parse;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
extern crate clap;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate env_logger;
|
||||
use clap::{Arg, App};
|
||||
use std::path::Path;
|
||||
mod compiler;
|
||||
|
||||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
let matches = App::new("RsPython")
|
||||
.version("0.0.1")
|
||||
.author("Windel Bouwman")
|
||||
.about("Rust implementation of the Python language")
|
||||
.arg(Arg::with_name("script")
|
||||
.required(true)
|
||||
.index(1))
|
||||
.arg(Arg::with_name("v")
|
||||
.short("v")
|
||||
.multiple(true)
|
||||
.help("Give the verbosity"))
|
||||
.get_matches();
|
||||
|
||||
// Figure out the filename:
|
||||
let script_file = matches.value_of("script").unwrap_or("foo");
|
||||
info!("Running file {}", script_file);
|
||||
|
||||
// Parse an ast from it:
|
||||
let filepath = Path::new(script_file);
|
||||
match compiler::parse(filepath) {
|
||||
Ok(program) => {
|
||||
debug!("Got ast: {:?}", program);
|
||||
let bytecode = compiler::compile(program);
|
||||
debug!("Code object: {:?}", bytecode);
|
||||
compiler::evaluate(bytecode);
|
||||
info!("Great succes!!");
|
||||
},
|
||||
Err(msg) => error!("Parsing went horribly wrong: {}", msg),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
extern crate rustpython_parser;
|
||||
extern crate py_code_object;
|
||||
use rustpython_parser::compiler::ast;
|
||||
use rustpython_parser::ast;
|
||||
use self::py_code_object::{PyCodeObject, NativeType};
|
||||
|
||||
struct Compiler {
|
||||
|
||||
@@ -10,7 +10,7 @@ extern crate rustpython_vm;
|
||||
mod compile_py_code_object;
|
||||
use clap::{Arg, App};
|
||||
use std::path::Path;
|
||||
use rustpython_parser::compiler;
|
||||
use rustpython_parser::parse;
|
||||
use rustpython_vm::VirtualMachine;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ fn main() {
|
||||
|
||||
// Parse an ast from it:
|
||||
let filepath = Path::new(script_file);
|
||||
match compiler::parse(filepath) {
|
||||
match parse(filepath) {
|
||||
Ok(program) => {
|
||||
debug!("Got ast: {:?}", program);
|
||||
let bytecode = compile_py_code_object::compile(program);
|
||||
|
||||
Reference in New Issue
Block a user