microcad-lang 0.2.5

µcad language
Documentation

µcad language

The µcad programming language is purely declarative, which means that a µcad program can be evaluated like a mathematical equation, resulting in a graphical output. It only needs to know the values of all the variables to obtain this result.

Program Structure

A µcad program can simply consist of a sequence of statements in a source file or more complex constructs such as workbenches and functions.

Additionally, modules help bundle things into packages and resolve naming collision issues.

With use statements functionalities of a module can be used in other modules.

Data Types

µcad knows several primitive types (like String and Integer) and quantity types which are always linked to a unit (like Length in mm or an Angle in °).

Collections (like tuples or arrays) can bundle other types into structured sets.

Produced 3D and 2D objects are stored in nodes.

It's planned to implement custom types in future.

Calls

In µcad you may call workbenches to produce objects from sketches or parts or you may call functions.

In both cases you shall read about argument multiplicity and argument matching to understand how µcad is processing arguments.

Objects

The 2D or 3D objects produced with workbenches can be measured or exported.

Libraries

µcad knows two kinds of libraries: Those which are written µcad language and those which are written in Rust.

The standard library is a µcad library which encapsulates the builtin library into a nice and convenient interface.

If you want to make your own libraries put you µcad code into the search paths or create a plugin to embed Rust code.

Debugging

There are several builtin debug functionalities which help you debugging your code.