Skip to content

Commit

Permalink
Merge pull request #44 from lf-lang/add-python
Browse files Browse the repository at this point in the history
Enable `lingo init -l python`
  • Loading branch information
erlingrj authored Oct 11, 2023
2 parents 2ed7d50 + a51108c commit 2fe15fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions defaults/HelloPy.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
target Python

main reactor {
reaction(startup) {=
print("Hello World!")
=}
}
7 changes: 7 additions & 0 deletions defaults/HelloRust.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
target Rust

main reactor {
reaction(startup) {=
println!("Hello World!");
=}
}
3 changes: 2 additions & 1 deletion src/package/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ impl ConfigFile {
let hello_world_code: &'static str = match self.apps[0].target {
TargetLanguage::Cpp => include_str!("../../defaults/HelloCpp.lf"),
TargetLanguage::C => include_str!("../../defaults/HelloC.lf"),
TargetLanguage::Python => include_str!("../../defaults/HelloPy.lf"),
TargetLanguage::TypeScript => include_str!("../../defaults/HelloTS.lf"),
_ => panic!("Target langauge not supported yet"), // FIXME: Add examples for other programs
_ => panic!("Target langauge not supported yet"), //FIXME: Add support for Rust.
};

write(Path::new("./src/Main.lf"), hello_world_code)?;
Expand Down

0 comments on commit 2fe15fe

Please sign in to comment.