Melody Lang —— 面向 JS 的新兴编程语言
Melody 是一种可将代码编译为 ECMAScript 正则表达式的语言,旨在更易于阅读和维护。
例子
注意:这些是当前支持的语法,可能会改变
Batman Theme
16 of "na"; 2 of match { <space>; "batman"; } // 🦇🦸 ♂️
转变成
(?:na){16}(?: batman){2}
Twitter Hashtag
"#"; some of <word>; // #melody
转变成
#\\w+
Introductory Courses
some of <alphabetic>; <space>; "1"; 2 of <digit>; // classname 1xx
转变成
[a-zA-Z]+ 1\\d{2}
Indented Code (2 spaces)
some of match { 2 of <space>; } some of <char>; ";"; // let value = 5;
转变成
(?: {2})+.+;
安装
Cargo
cargo install melody_cli
从源代码
git clone https://github.com/yoav-lavi/melody.git
cd melody
cargo install --path crates/melody_cli
Binary
- macOS binaries (aarch64 and x86_64) 可从 release 页面下载
