Skip to main content

Overview

The Knot Language is made up of a number of different layers.

Modules

Modules are the largest constructs in Knot, they can contain multiple declarations such as functions and views. Modules can import and export entities so that code stored in a different modules can be accessed and reused. Modules are referred to using a name that is based on their path from the source directory of your project.

Declarations

Entities can only be declared within a module (functions can technically be created anonymously within a closure by using lambda expressions). Each type of entity is used to define an independent, re-usable piece of an application.

Statements

The let bindings are only available to define variables within a closure, such as a function body.

Expressions

As a functional language, Knot was designed to make as much of the language usable as an expression so it can be easily composed. These include simple primitives like booleans and integers as well as binary operations, unary operations, closures and more!

Primitives

The most basic types you can use to describe data in your application. These include nil, boolean, integer, float, string and element.