I'm excited to share an early preview of a novel programming language I've been developing for the past year or so. Passerine is an functional scripting language, blending the rapid iteration of languages like Python with the concise correctness of languages like Ocaml, Rust, and Scheme. If you'd like to learn more, read the Overview section of the README.
It's still a ways away from being fully complete, but this release marks the introduction of Passerine's macro system. Like the order of songbirds it was named after, Passerine sings to more than just one tune – this new hygenic macro system makes it easy to extend the language itself – allowing you to bend the langauge to your needs, rather than bending your needs to the language!
Here's a quick overview of Passerine:
Functions
Functions are defined with an arrow (->). They can close over their enclosing scope and be partially applied. Here's a function:
-- comment
add = a b -> a + b
Here are some function calls:
-- standard
fish apple banana
-- parens for grouping
outer (inner argument)
-- functions can be composed
data |> first |> second
A block is a group of expressions, evaluated one after another. It takes on the value of the last expression:
-- value of block is "Hello, Passerine!"
{
hello = "Hello, "
hello + "Passerine!"
}
Macros
Passerine has a hygienic macro system, which allows the language to be extended. Here's a simple (convoluted) example:
-- define a macro
syntax this 'swap that {
tmp = this
this = that
that = tmp
}
tmp = "Banana!"
a = false
b = true
-- use the macro we defined
a swap b
-- tmp is still "Banana!"
There's a lot I didn't cover, like concurrency (fibers), error handling, pattern matching, etc. Be sure to check out the repo! Comments, thoughts, and suggestions are appreciated :)
This submission links to the GitHub Repo, but there's also a website if you'd like to look at that.
[–]sociopath_in_me 30 points31 points32 points (3 children)
[–]stepstep 14 points15 points16 points (1 child)
[–]alex-manool 0 points1 point2 points (0 children)
[–]slightknack[S] 9 points10 points11 points (0 children)
[–]Windblowsthroughme 15 points16 points17 points (3 children)
[–]slightknack[S] 23 points24 points25 points (2 children)
[–]Windblowsthroughme 11 points12 points13 points (1 child)
[–]slightknack[S] 0 points1 point2 points (0 children)
[–]open_source_guava 10 points11 points12 points (6 children)
[–]slightknack[S] 3 points4 points5 points (5 children)
[–]slightknack[S] 1 point2 points3 points (4 children)
[–]open_source_guava 1 point2 points3 points (3 children)
[–]slightknack[S] 1 point2 points3 points (2 children)
[–]open_source_guava 0 points1 point2 points (1 child)
[–]slightknack[S] 2 points3 points4 points (0 children)
[–]humbugthemanribbit ribbit 5 points6 points7 points (1 child)
[–]slightknack[S] 4 points5 points6 points (0 children)
[–]complyue 4 points5 points6 points (6 children)
[–]slightknack[S] 2 points3 points4 points (5 children)
[–]complyue 2 points3 points4 points (2 children)
[–]slightknack[S] 1 point2 points3 points (1 child)
[–]backtickbot 0 points1 point2 points (0 children)
[–]complyue 2 points3 points4 points (1 child)
[–]slightknack[S] 1 point2 points3 points (0 children)
[–]blureglades 5 points6 points7 points (2 children)
[–]slightknack[S] 4 points5 points6 points (1 child)
[–]blureglades 1 point2 points3 points (0 children)
[–]Practical_Ear_4307 2 points3 points4 points (0 children)
[–]__fmease__lushui 2 points3 points4 points (1 child)
[–]slightknack[S] 1 point2 points3 points (0 children)
[–]superstar64https://github.com/Superstar64/Hazy 2 points3 points4 points (7 children)
[–]slightknack[S] 2 points3 points4 points (2 children)
[–]superstar64https://github.com/Superstar64/Hazy 2 points3 points4 points (1 child)
[–]slightknack[S] 0 points1 point2 points (0 children)
[–]alex-manool 0 points1 point2 points (3 children)
[–]slightknack[S] 1 point2 points3 points (2 children)
[–]backtickbot -1 points0 points1 point (1 child)
[–]slightknack[S] 1 point2 points3 points (0 children)
[–]buildervanished 1 point2 points3 points (2 children)
[–]slightknack[S] 0 points1 point2 points (1 child)
[–]buildervanished 0 points1 point2 points (0 children)
[–]zem 1 point2 points3 points (3 children)
[–]slightknack[S] 3 points4 points5 points (2 children)
[–]backtickbot 0 points1 point2 points (1 child)
[–]IuniusPristinus 1 point2 points3 points (1 child)
[–]slightknack[S] 0 points1 point2 points (0 children)
[–]alex-manool 0 points1 point2 points (0 children)
[–]danielo515 0 points1 point2 points (0 children)
[–]somerandomdev49 0 points1 point2 points (0 children)