Syntax & Variables
Pyle source is line-oriented, but semicolons and braces give you control over statement boundaries. The syntax is deliberately close to JavaScript and Lua without trying to be either.
Comments
Section titled “Comments”Comments start with # and run to the end of the line. There are no block comments.
# This is a comment.let x = 1 # This is also a comment.Statements and blocks
Section titled “Statements and blocks”A statement ends at a newline, a semicolon, or a closing brace. Braces create a block.
if ready { print("one") print("two")}
if ready { print("one"); print("two") }Single-statement bodies do not need braces:
if score > 90 print("A")while running tick()Strings
Section titled “Strings”Strings use double quotes only. Single quotes are not string delimiters.
let greeting = "hello"let escaped = "line one\nline two"Supported escapes are \n, \e, \t, \r, \\, \", \', and \0.
There is no implicit concatenation. Use +:
let name = "Pyle"let message = "hello, " + nameStrings are byte strings. size() counts bytes, indexing returns a one-byte string, and iteration yields bytes. Multibyte UTF-8 is not treated as a sequence of characters.
print("héllo".size()) # 6, not 5print("hello"[0]) # "h"Numbers
Section titled “Numbers”Integers are 64-bit signed values. Decimal and hexadecimal literals are supported.
let count = 42let mask = 0xFFFloats must have a decimal point followed by at least one digit.
let pi = 3.14159let half = 0.51. is parsed as the integer 1 followed by a field access dot, not as a float. Write 1.0 instead.
Integer arithmetic wraps on overflow, following two’s complement. Division and modulo by zero raise a runtime error.
Booleans and none
Section titled “Booleans and none”let yes = truelet no = falselet missing = nonenone, false, 0, and 0.0 are falsy. Everything else is truthy, including empty arrays and empty maps.
if [] print("empty arrays are truthy")if {} print("empty maps are truthy")Variables
Section titled “Variables”let declares a variable. Reassignment omits let.
let name = "Pyle"let count = 0
count = 1count += 1Compound assignment operators are +=, -=, *=, /=, &=, |=, ^=, <<=, and >>=. There is no ++ or --.
count += 1flags |= 0x04Variables are block-scoped. A variable declared inside a block is not visible outside it.
if true { let local = 1 print(local)}# print(local) would be a NameErrorAt module top level, declarations are globals for that module.
Identifiers and keywords
Section titled “Identifiers and keywords”Identifiers start with a letter or underscore and continue with letters, digits, or underscores. They are case-sensitive. Keywords are reserved lowercase words such as let, fn, if, elif, else, while, for, in, loop, break, continue, return, struct, enum, static, and, or, not, yield, and self.
Semicolons
Section titled “Semicolons”Semicolons are optional separators, not terminators. They are useful when you want two statements on one line.
let a = 1; let b = 2print(a + b)Next steps
Section titled “Next steps”- Types & Values for the full value model.
- Operators for precedence and behavior.
- Control Flow for loops and conditionals.