Skip to content

Releases: mech-lang/mech

v0.2.46-beta

18 Jun 02:18

Choose a tag to compare

Mechdown Diagrams

Added support for diagrams in Mechdown via Mermaid.

You can see an example here:

https://docs.mech-lang.org/V.examples/ekf.html#62758183329167312

The way it works is you just use Mermaid syntax within a code fence with the "diagram" or "mermaid" label.

Repl docs

Added a :docs command in the REPL that will fuzzy search docs and write the contents of the result in the console window.

Windows Installer

Added a windows installer (attached to this release). This will install the mech binary into Program Files, add Mech to the PATH, associate .mec files with the mech runtime. There's only a Windows installer for now.

More Monorepo

Moved Docs and Examples and Notebook into the monorepo. Those repos are now archived.

Various bug fixes as well.

Full Changelog: v0.2.45-beta...v0.2.46-beta

v0.2.45-beta

10 Jun 19:45

Choose a tag to compare

This release has several features and many bugfixes.

Responsive Docs

The first big feature is that the docs are now responsive to the screen size, so they can be viewed on a phone. These are now live on https://docs.mech-lang.org so you can see how they work there.

Comment Paragraphs

The second feature is that now comments are parsed as paragraphs. This unlocks a cool ability to print out the value of a variable in a comment proceeding it. For example:

  days-per-year := 365.24
  π := 3.141592654
  solar-mass := 4 * π ^ 2
  Δt := 0.01  -- This is equivalent to {1 / Δt} Hz.

When this program runs, the code in the {1 / Δt} will be executed and then the value "100" will replace the formula.

We also added the ability to format inline Mech code with {{}}. For example:

The expression {{solar-mass := 4 * π ^ 2;}} is a result of using normalized astronomical units.

The code within the {{}} will be parsed and formatted, but not executed.

Multiline Strings

This is now valid code:

x := "Hello 
 World"

Bug Fixes

Various bug fixes. Here are the highlights:

  • There was a problem with formulas having newlines within them and conflating a table with a formula during parse. This is fixed by preventing more than one newline in the whitespace before an operator in a formula.
  • Fixed a bug where mech output in tables wasn't being rendered
  • Fixed a lot of formatting bugs in Mechdown

Full Changelog: v0.2.44-beta...v0.2.45-beta

v0.2.42-beta 🐬

19 May 17:17

Choose a tag to compare

Combinatorics

Added a combinatorics machine. It only has one function for now, combinatorics/n-choose-k, which will be used in the n-body example instead of hard coding the combinations.

Full Changelog: v0.2.41-beta...v0.2.42-beta

v0.2.41-beta

13 May 04:32

Choose a tag to compare

Bug Fix

There was a bug when a numbered list was followed by a subtitle, the subtitle would be parsed as a list element followed by a mech -- comment. Fixed it to work as expected.

Docs

Now that Mechdown is further along, we are making more progress on docs. You can find them at docs.mech-lang.org. Not too much yet but the outline. Also the Roadmap has been updated and formatted as an HTML document.

Full Changelog: v0.2.40-beta...v0.2.41-beta

v0.2.40-beta

06 May 05:20

Choose a tag to compare

Modulo operator

Modulo operator % has been implemented.

([1 2 3 4 5] % 5) == [1 2 3 4 0]

Matrix initialize

Added the ability to initialize matrices with default values, which includes type conversion:

Create a 1x4 matrix where each element is 123:

x:=123;
y<[f64]:1,4> := x;

Create a 3x3 matrix of u8 from a f32 value 456.0:

y<[u8]:3,3> := 456<f32>;

Create a matrix [1 2 3] of f64, convert to a matrix of u64, then convert that to a matrix of u8:

x := [1 2 3];
y<[u64]> := x;
z<[u8]> := y;

io machine

We have brought the io machine up to v0.2 standards. We have implemented two functions

  • io/print()
  • io/println()

They only work for matrix and scalar types so far, we need to implement the rest in the next update.

Fizz Buzz

These three features together allow us to implement the classic "FizzBuzz" program with a Mech flavor:

  x := 1..=1000
  ~y<[string]> := x
  ix3 := (x % 3) == 0 ; ix5 := (x % 5) == 0
  y[ix3] = "✨"
  y[ix5] = "🐝"
  y[ix3 & ix5] = "✨🐝"
  io/println(y)

Notice on the second line, a [f64] is assigned to a [string], which causes a type conversion for each element of the matrix.

Full Changelog: v0.2.38-beta...v0.2.40-beta

v0.2.39-beta

28 Apr 14:19

Choose a tag to compare

New Mechdown Features

Equations

You can now render LaTeX equations in your Mechdown documents. e.g.

$$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Or you can write them inline like $$c^2 = a^2 + b^2$$.

Works Cited

Support for citation style links were added. e.g.

This is a citation [1].
[1]: www.example.com

This is also a citation [WEB]
[WEB]: D. E. Knuth, *Literate Programming*, 1984.

The Mechdown compiler will automatically collect the various references and render them at the end of the document in a dynamically generated "works cited" section. Citations are automatically numbered and sorted, with the first citation in narrative order being [1] and so forth.

Float Section Element

Added syntax to float section elements left or right. To float left, prefix the block with <<; to float right, prefix the block with >>

For instance, float image to the left:

<<!["Literate Programming" by Donald Knuth, 1982 [KNUTHBOOK]](https://upload.wikimedia.org/wikipedia/en/6/62/Literate_Programming_book_cover.jpg)

Float a quote to the right

>>> This is a quote floating to the right.

Highlight

You can highlight a paragraph element with !! e.g.

This is a sentence in a paragraph. !!This is a highlighted span!! Pay attention to that!

Full Changelog: v0.2.38-beta...v0.2.39-beta

v0.2.38-beta

15 Apr 01:27

Choose a tag to compare

This release includes support for new section and paragraph elements for Mechdown:

  • List
    • Numbered
    • Unordered
    • Check
    • Nested
  • Footnotes
  • Thematic breaks
  • Block quotes
  • Code blocks
  • Abstract
  • Image
  • Table
  • Paragraphs
    • Hyperlink
    • Inline code
    • Strong
    • Emphasis
    • Strikethrough
    • Underline

Equation rendering support is scheduled for the next release.

The language spec (WIP) is a good example of the formatted output: https://docs.mech-lang.org/v0.2/II.reference/specification.html
Source code can be found for this document here: https://gitlab.com/mech-lang/docs/-/raw/v0.2-beta/II.reference/specification.mec?ref_type=heads

Full Changelog: v0.2.36-beta...v0.2.38-beta

v0.2.36-beta

31 Mar 21:13

Choose a tag to compare

Mechdown enhancements

New Section Elements

  • block quote
  • grammar block
  • table
  • thematic break

New Paragraph Elements

  • strong
  • emphasis
  • underline
  • strikethrough
  • links
  • inline code

New docs:

Full Changelog: v0.2.35-beta...v0.2.36-beta

v0.2.35-beta

20 Mar 18:44

Choose a tag to compare

Better Formatter

Major changes to the formatter. Here's an example program formatted as an html document:

https://mech-lang.org/nbody.html

Language Spec

Now that we have a way to print these things nicely, work has begun on the language spec. Here's what it looks like so far:

https://mech-lang.org/specification.html

This is supposed to be a one-page document that specifies the syntax and semantics of the base Mech language. Most of the work here went toward formatting the TOC and all of the html elements properly. This document should replace grammar.mec when it's complete.

There are known bugs in the grammar here, they will be fixed as the whole document is written.

New paragraph elements

  • strong
  • emphasis
  • strikethrough
  • underline
  • inline code

More coming. Because of the syntax for these, *, _, ~, and ` now have to be escaped if you want to write them out in a paragraph.

Full Changelog: v0.2.34-beta...v0.2.35-beta

v0.2.34-beta

07 Mar 16:27

Choose a tag to compare

Mech File System

The big addition this release is MechFS. With this and the formatter, we can serve Mech files as a website.

e.g.

mech serve dir1 index.mec file2.mec

Starts a server, with a directory "dir1", and two files: index.mec and file2.mec.

Then you can navigate to localhost:8081/index.mec or localhost:8081/file2.mec, or any of the files in dir1. This serves the source as a formatted html file.

Code is hosted at the /code endpoint.

e.g.

localhost:8081/code/index.mec

It's the program AST, compressed and encoded. So whoever requests it, doesn't have to recompile it they just have to decompress and decode.

Full Changelog: v0.2.33-beta...v0.2.34-beta