Melody is a language designed to compile to and maintain a 1-1 relationship with regular expressions, while being more readable and maintainable.
Featured Content Ads
add advertising hereThe current goal is supporting the JavaScript implementation of regular expressions.
Examples
Note: these are for the currently supported syntax and may change
Batman Theme
;
“batman”;
}
“batman”;
}
Featured Content Ads
add advertising here// 🦇🦸♂️”>
16 of "na"; 2 of match { space>; "batman"; } // 🦇🦸♂️
Turns into
/(?:na){16}(?:sbatman){2}/
Twitter Hashtag
Turns into
Introductory Courses
;
// classname 1xx”>
some of word>;
space>;
"1";
2 of digit>;
// classname 1xx
Turns into
Install
From Source
git clone https://github.com/yoav-lavi/melody.git cd melody cargo install --path .
CLI Usage
melody [OPTIONS] PATH>
OPTIONS:
-f, --file FILE> write to an output file
-n, --no-color print output with no color
-V, --version print version information
-h, --help print help information
Keywords
of
– used after a number or a range and before a sequence to be matched, e.g.5 of "A";
, equivalent to regex{5}
to
– used to create a range (either as a quantifier or as a character range), e.g.5 to 9
, equivalent to regex{5,9}
if before anof
or[5-9]
otherwisecapture
– used to open acapture
or namedcapture
block, equivalent to regex(...)
match
– used to open amatch
block, equivalent to regex(?:...)
start
– matches the start of the string, equivalent to regex^
end
– matches the end of the string, equivalent to regex$
char
– matches a single character, equivalent to regex.
some
– used withof
to express 1 or more of a pattern, equivalent to regex+
Symbols
– equavalent to regexs
– equavalent to regexn
– equavalent to regext
– equavalent to regexr
– equavalent to regexf
– equavalent to regex