Skip to content
Nikitin Ilya edited this page May 30, 2020 · 7 revisions

Scope is one of the most important and useful expressions in language. It is used as a body for classes, functions/lambdas, loops, and it can appear in macros.

It has 3 valid syntax descriptions (styles):

Indentation

class Example
	fn a
		for x in [1..10]
			print(x)

Commonly used to specify blocks of almost all expressions, and it's a most preferred style.
This style does not work, if scope is enclosed in any type of brackets.

Braces

print-cube = collection.map(fn (x) {
	r = x * x * x
	print(r)
	return r
})

Used to denote body of multiline anonymous functions. Second case is usage in place, where indentation is not allowed (for example, inside a code quote):

macro x ('cool-loop')
	return {{
		while true {
			print("😎")
		}
	}}

One-line

let p = fn (x) print(x)

This compact style is used to specify a small scope with only 1 expression.

Introduction to language syntax

Expressions

Toolset architecture

Public compiler interface

  • Units & Modules - TODO
  • Compiler class

Backend

  • Lexer (Tokenizer)
  • Syntax tree
  • Traversing

Miscellaneous

Clone this wiki locally