mers/README.md

36 lines
1.6 KiB
Markdown
Raw Normal View History

2023-04-30 22:34:11 +02:00
# mers ![build status](https://github.com/Dummi26/mers/actions/workflows/rust.yml/badge.svg)
2023-04-01 20:30:34 +02:00
Mers is an experimental programming language inspired by high-level and scripting languages, but with error handling inspired by rust.
2023-05-18 01:07:15 +02:00
## Why mers?
2023-05-18 01:07:15 +02:00
mers has...
2023-05-18 01:07:15 +02:00
- the type-safety of statically typed languages
+ mers will not crash unless you `exit()` with a nonzero exit code or write flawed assumptions using the builtin `.assume*()` functions (Rust's `unwrap` or `expect`)
- the flexibility of dynamically typed languages
+ `x = if condition() { "my string" } else { 12 } // <- this is valid`
- "correctness" (this is subjective and I'll be happy to discuss some of these decisions with people)
+ there is no `null` / `nil`
+ all references are explicit: if you pass a list by value, the original list will *never* be modified in any way.
+ errors are normal values! (no special treatment)
- a flexible type system to easily represent these errors and any complex structure including recursive types:
+ nothing: `[]` (an empty tuple)
+ a string: `string`
+ two strings: `[string string]` (a tuple)
+ many strings: `[string ...]` (a list)
+ Either a string or nothing (Rust's `Option<String>`): `string/[]`
+ Either an int or an error: (Rust's `Result<isize, String>`): `int/string` (better: `int/Err(string)`)
- compile-time execution through (explicit) macro syntax
2023-05-18 01:07:15 +02:00
## How mers?
2023-05-18 01:07:15 +02:00
Mers is written in rust. If you have `cargo`, use the build script in `build_scripts/` to produce the executable.
2023-05-18 01:07:15 +02:00
Now, create a new text file (or choose one from the examples) and run it: `mers <file>`.
2023-05-18 01:07:15 +02:00
## Docs
2023-05-24 23:35:42 +02:00
[syntax cheat sheet](docs/syntax_cheat_sheet.md)
2023-05-18 01:07:15 +02:00
[intro](docs/intro.md)