From c1e214c701bd89c43e3a010a156678437496a0f3 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 26 Nov 2017 21:17:17 -0800 Subject: [PATCH] Add a new language - Rukka This is a (simple) lisp, partially for fun, partially for testing the generic interfaces --- src/main.rs | 2 ++ src/rukka_lang/mod.rs | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/rukka_lang/mod.rs diff --git a/src/main.rs b/src/main.rs index f4a4ca6..87599e1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ extern crate maplit; mod schala_lang; mod maaru_lang; mod robo_lang; +mod rukka_lang; extern crate schala_lib; use schala_lib::{PLIGenerator, schala_main}; @@ -22,6 +23,7 @@ fn main() { Box::new(|| { Box::new(schala_lang::Schala::new())}), Box::new(|| { Box::new(maaru_lang::Maaru::new())}), Box::new(|| { Box::new(robo_lang::Robo::new())}), + Box::new(|| { Box::new(rukka_lang::Rukka::new())}), ]; schala_main(generators); } diff --git a/src/rukka_lang/mod.rs b/src/rukka_lang/mod.rs new file mode 100644 index 0000000..6f1dde3 --- /dev/null +++ b/src/rukka_lang/mod.rs @@ -0,0 +1,24 @@ +use itertools::Itertools; +use schala_lib::{ProgrammingLanguageInterface, EvalOptions, ReplOutput}; + +pub struct Rukka { } + +impl Rukka { + pub fn new() -> Rukka { Rukka { } } +} + +impl ProgrammingLanguageInterface for Rukka { + fn get_language_name(&self) -> String { + "Rukka".to_string() + } + + fn get_source_file_suffix(&self) -> String { + format!("rukka") + } + + fn evaluate_in_repl(&mut self, input: &str, _eval_options: &EvalOptions) -> ReplOutput { + let mut output = ReplOutput::default(); + output.add_output(format!("Everything is ()")); + output + } +}