Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrxiaozhuox/dioscript
A programming language made by Rust
https://github.com/mrxiaozhuox/dioscript
Last synced: 18 days ago
JSON representation
A programming language made by Rust
- Host: GitHub
- URL: https://github.com/mrxiaozhuox/dioscript
- Owner: mrxiaozhuox
- License: apache-2.0
- Created: 2023-05-10T00:41:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-19T08:18:43.000Z (about 2 months ago)
- Last Synced: 2024-10-11T01:51:06.691Z (about 1 month ago)
- Language: Rust
- Homepage:
- Size: 22.8 MB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DioScript
> Dioscript is a script language use for generate web elements.
```dioscript
username = "YuKun Liu";
login = false;display_navbar = true;
if display_navbar == false {
return "unavailable navbar.";
}return div {
class: "navbar",
h1 { username },
if login {
return h2 { "Hello User!" };
} else {
return h2 { "Hello Guest! };
}
};```
## Function Bind
Currently, You can bind **Rust** function to dioscript-runtime, and call it in dioscript code.
```rust
fn element_to_html(args: Vec) -> Value {
let v = args.get(0).unwrap();
if let Value::Element(e) = v {
return Value::String(e.to_html());
}
Value::None
}// import function
runtime.bind_module("html", {
let mut module = ModuleGenerator::new();
module.insert_rusty_function("to_html", element_to_html, 1);
module
});```
```dioscript
e = div {
class: "main",
p { "Hello Dioscropt" }
};return html::to_html(e);
// result
//Hello Dioscript
```
## Runtime
Dioscript includes a very simple runtime, it will work for `conditional statements`, `variable scope`, `element internal statements`, and `value calculate`.
## Usage
Currently, I am working on a library that can convert `Dioxscript` to `Dioxus` components, and that can help Dioxus Web to dynamically generate & display page components.