Crates.io | meadorc |
lib.rs | meadorc |
version | 0.1.0 |
source | src |
created_at | 2023-11-21 16:32:37.73977 |
updated_at | 2023-11-21 16:32:37.73977 |
description | meador scripting language compiler |
homepage | |
repository | |
max_upload_size | |
id | 1044399 |
size | 40,025 |
Meador is a simple, custom scripting language designed for educational purposes.
Meador is a statically-typed language with a syntax similar to JavaScript and Rust. It supports variables, functions, and basic control flow structures.
let
keyword.if
, else
, while
loop are supported.The grammar of the Meador language is defined as follows:
program = { statement+ ~ EOI }
int = { ("+" | "-")? ~ ASCII_DIGIT+ }
decimal = @{ int ~ "." ~ ASCII_DIGIT* }
ident = @{ ASCII_ALPHA ~ (ASCII_ALPHANUMERIC | "_")* }
statement = { variable_declaration | if_stmt | while_loop | code_block | function_call_stmt }
variable_declaration = { "let" ~ ident ~ "=" ~ expr ~ ";" }
while_loop = { "while" ~ expr ~ statement }
code_block = { "{" ~ statement* ~ "}"}
if_stmt = { "if" ~ expr ~ statement ~ ("else" ~ statement)? }
expr = { value ~ (bi_operator ~ value)* }
value = { parenthesis | decimal | int | boolean | function_call | ident }
boolean = { "true" | "false" }
parenthesis = { "(" ~ expr ~ ")" }
function_call = { ident ~ "(" ~ expr* ~ ")" }
function_call_stmt = { function_call ~ ";" }
bi_operator = {
"&&" | "||" |
"+" | "-" | "*" | "/" | "^" |
"==" | "<=" | ">=" | "!=" | "<" | ">"
}