Lexical Structure
Nilakan source is organized as lines of Python-like statements. Indentation is significant inside blocks.
Keywords
Section titled “Keywords”| Category | Keywords |
| ---------------------- | -------------------------------------------------------------------------------- |
| Definitions and blocks | def, init, pragma, while, if, elif, else, return, try, catch |
| Booleans | True, False |
| Operators | and, or, not, in |
print is a reserved built-in procedure name, not a keyword.
Syntax
Section titled “Syntax”Line comments start with # and continue to the end of the line. The first recognized comment
delimiter wins. Once a line comment starts, later ### text on that line remains part of the line
comment and cannot open a block comment.
# This is a comment.x = 1 # This is also a comment.Block comments are delimited with ###.
###This block is ignored by the lexer.###x = 1Block comments can appear inline. An unterminated block comment is a syntax error. Comment delimiters inside string literals are preserved as string content.
Strings may use single quotes, double quotes, triple single quotes, or triple double quotes. Nilakan
decodes exactly \n, \r, \t, \\, \', and \". Any other backslash escape is
SyntaxError/NLK1005; Nilakan never silently drops an unknown backslash. Triple-quoted strings can
span lines; a backslash followed by a physical newline removes that newline.
name = "Nilakan"message = 'hello'long = """multiplelines"""escaped = "a\nb"Nilakan does not currently support hexadecimal, Unicode-name, octal, raw-string, or bytes-literal escapes. Write the Unicode character directly when practical.
Number literals are decimal integers or decimal fractions. Exponents are not implemented.
count = 3ratio = 0.5Identifiers match this shape:
[A-Za-z_][A-Za-z0-9_]*A primed identifier adds one or more trailing apostrophes and names a future state layer in a commit loop.
value = 1value' = value + 1value'' = value' + 1Semantics
Section titled “Semantics”Spaces define indentation. Tabs are rejected.
Semicolons separate statements on the same line.
x = 1; y = 2; print(x + y)Newlines are ignored inside (), [], and {}. A newline before . also continues a method
chain. Line and block comments may appear between chained method calls.
xs = [ 1, 2, 3,]
ys = xs .append(4) .reverse()Constraints And Errors
Section titled “Constraints And Errors”Tabs in indentation are syntax errors. Indentation must return to a previous indentation level when a block closes.
Step slices such as xs[0:4:2] are not implemented. A standalone {} is a dict, not a set; use
set() for an empty set.
Examples
Section titled “Examples”items = ["a", "b"]updated = items .append("c") .reverse()print(updated)