An experimental Rust implementation of the Marlowe DSL for Cardano smart (financial) contracts. It allows you to create Marlowe contracts from Rust rather than using Marlowe directly.
It is used by the MarloweLSP VSCode Extention (Syntax highlighting for Marlowe in VSCode).
This crate was created as a learning exercise and should not be trusted anywhere near a production environment at this time.
It is a side-project and might be dropped completely at any time (it may already be dead!)
The pest.rs grammar file is just an initial attempt to make sense of the language from a high level. It will likely have to be rebuilt from the ground up when Marlowe v3 is official.
```rust use marlowelang::types::marlowe::*; use marlowelang::parsing::{ deserialization::deserialize, serialization::serialize, };
let mycontract = Contract::When { cases: vec![ Some(Case { action: Some(Action::Notify { notifyif: Some(Observation::TrueObs) }), contract: Some(Contract::Close.boxed()) } ) ], timeout: Some(imeout::TimeParam("test".into())), timeout_continuation: Some(Contract::Close.boxed()), };
let serialized = serialize(my_contract); let deserialized : Contract = deserialize(&serialized).unwrap(); println!("{serialized}"); ```
text
When [ Case (Notify (TrueObs)) Close ] (TimeParam "test") Close
bash
rustup default nightly
cargo install marlowe_lang
```text
USAGE:
marlowelangcli.exe
OPTIONS: -h, --help Print help information -V, --version Print version information
SUBCOMMANDS: contract Tools for working with contracts datum Tools for working with datums help Print this message or the help of the given subcommand(s) plutus-data Tools for working with unknown plutus data redeemer Tools for working with inputs/redeemers (marlowe actions) state Tools for working with state ```