Trying webapp

Note this doesn't work yet
This commit is contained in:
greg 2017-09-19 01:54:54 -07:00
parent e3b236a15d
commit 006fd7d411
4 changed files with 24 additions and 0 deletions

View File

@ -16,4 +16,6 @@ colored = "1.5"
serde = "1.0.15"
serde_derive = "1.0.15"
serde_json = "1.0.3"
rocket = "*"
rocket_codegen = "*"

View File

@ -58,3 +58,7 @@ http://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-ma
### LLVM
http://blog.ulysse.io/2016/07/03/llvm-getting-started.html
###Rust resources
https://thefullsnack.com/en/rust-for-the-web.html
https://rocket.rs/guide/getting-started/

View File

@ -24,6 +24,8 @@ mod robo_lang;
mod language;
use language::{ProgrammingLanguageInterface, EvalOptions, LLVMCodeString};
mod webapp;
mod llvm_wrap;
mod virtual_machine;
@ -69,6 +71,11 @@ fn main() {
std::process::exit(0);
}
if option_matches.opt_present("w") {
webapp::web_main();
std::process::exit(0);
}
let language_names: Vec<String> = languages.iter().map(|lang| {lang.get_language_name()}).collect();
let initial_index: usize =
option_matches.opt_str("l")
@ -361,6 +368,9 @@ fn program_options() -> getopts::Options {
options.optflag("a",
"assembler",
"Assemble file into bytecode");
options.optflag("w",
"webapp",
"Start up web interpreter");
options
}

8
src/webapp.rs Normal file
View File

@ -0,0 +1,8 @@
#[get("/")]
fn index() -> &'static str {
"rocket test"
}
fn web_main() {
rocket::ignite().mount("/", routes![index]).launch();
}