-
Notifications
You must be signed in to change notification settings - Fork 2
Scopes
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):
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.
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("😎")
}
}}
let p = fn (x) print(x)
This compact style is used to specify a small scope with only 1 expression.
Expressions
Public compiler interface
-
Units & Modules
- TODO -
Compiler
class
Backend
- Lexer (Tokenizer)
- Syntax tree
- Traversing