Skip to content
Timothy Hewitt edited this page Apr 1, 2015 · 1 revision

#Syntax

PSIL's syntax is deceptively simple. It has three primary elements: Expressions, Literals, and References.

##Expressions

Expressions are the primary building block of a PSIL program. They start and end with opening and closing parenthesis, ( and ). Between these two parenthesis go the two other syntactic elements, Literals and References. When an ending parenthesis is encountered, the interpreter tries to pop a code literal off the stack and execute it in a new environment.

##Literals

Literals come in three flavors: Numeric, String, and Code. All three implicitly call the string based constructor for that type which pushes the new value to the stack.

###Numeric

Numeric Literals are simply numbers. PSIL currently only supports decimal numbers, though other radix integers could be supported in the future. Numbers with a period in them produce Float objects, while numbers without produce Integer objects. The differences between the two are covered in the Numerics page.

###String

String literals are surrounded by double quotes ". Currently they do not support escaping except for double quotes, plans are to allow for insertion of newlines with "\n" and escaping indentation on multiline strings.

###Code

Code literals are the most important and most complicated part of PSIL. These constructs are delimited by { and } and contain expressions inside. These code literal objects can be placed on the stack and bound in the namespace.

##References

References are paths through the namespace graph, starting somewhere along the upward search path. They are concatenated with :.

Clone this wiki locally