Simple process reaction
This commit is contained in:
28
src/main.rs
28
src/main.rs
@ -1,16 +1,32 @@
|
||||
mod rsprocess;
|
||||
use lalrpop_util::lalrpop_mod;
|
||||
use std::io;
|
||||
// use std::io;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
lalrpop_mod!(grammar, "/rsprocess/grammar.rs");
|
||||
|
||||
let mut buffer = String::new();
|
||||
let i = io::stdin();
|
||||
i.read_line(&mut buffer).expect("Can't read stdin");
|
||||
// let mut buffer = String::new();
|
||||
// let i = io::stdin();
|
||||
// i.read_line(&mut buffer).expect("Can't read stdin");
|
||||
|
||||
let result = grammar::BHMLParser::new().parse(&buffer).unwrap();
|
||||
println!("{:?}", result);
|
||||
// let result = grammar::SetParser::new().parse(&buffer).unwrap();
|
||||
|
||||
|
||||
let reactants = grammar::SetParser::new().parse("{a}").unwrap();
|
||||
let inihibitors = grammar::SetParser::new().parse("{c}").unwrap();
|
||||
let products = grammar::SetParser::new().parse("{a,c}").unwrap();
|
||||
|
||||
let process1 = rsprocess::structure::RSreaction::from(reactants, inihibitors, products);
|
||||
|
||||
let reactants = grammar::SetParser::new().parse("{b}").unwrap();
|
||||
let inihibitors = grammar::SetParser::new().parse("{c}").unwrap();
|
||||
let products = grammar::SetParser::new().parse("{b,c}").unwrap();
|
||||
|
||||
let process2 = rsprocess::structure::RSreaction::from(reactants, inihibitors, products);
|
||||
|
||||
let current_state = grammar::SetParser::new().parse("{b}").unwrap();
|
||||
|
||||
println!("{:?}", rsprocess::classical::compute_all(¤t_state, vec![&process1, &process2]));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user