Skip to content
Nikitin Ilya edited this page Apr 29, 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 can appear in macros.

It has 3 valid syntax descriptions (styles):

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

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

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

This style is mainly used to denote body of multiline anonymous functions. Second case is usage in place, where indentation is not allowed For example, as above, or inside a code quote:

macro x ('cool-loop')
	return {{
		while true {
			print("😎")
		}
	}}
  1. One-line style
let x = fn (x): print(x)

This compact style is used to specify 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