Some commonly used terms used by a Sling compiler as well as within this document:

Token is a lexical unit within a Sling source code file that is composed of a sequence of one of more characters, comprising the smallest unit of code within a Sling program.

Identifier is a specific token that is composed of a consecutive series of the following: (1) lowercase and uppercase characters (a-z and A-Z), (2) decimal numbers (0-9) and (3) underscore characters (_). However, an identifier cannot start with a decimal number.

Literal is a type of a token that represents a literal or constant value that is defined as part of the source code rather than being determined dynamically when the program executes.

As an overall structure, all Sling code files are composed of (as mentioned) a sequence of UTF-8 encoded characters, which, grouped together, form a sequence of tokens. These tokens, taken together, represent the functionality and structure of the given program. Some of these tokens represent identifiers, some of them represent operators, literals, comments (see below), etc.

Other notable terms include:

A code tree is composed of a collection of different code elements (commonly called nodes) that together form the representation of a complete program. Typically, multiple source code files and the declarations contained within them are processed together, wherein they are considered to form a "tree" structure where each of the elements is placed in a particular location in the tree, defined by the name and other attributes of each given element. In this tree structure, elements or nodes can contain "children" that are contained inside other elements.

Namespaces offer a way to organize hierarchies of entities (see below) by way of grouping several entities together and providing those groups with common names. Namespaces can contain other namespaces, which may again contain other namespaces, while any namespaces can also contain any number of entities (see below). A namespace will always need to have a name, which is represented as a valid identifier (see above).

The fully qualified name of a node (usually a namespace or entity) is composed by appending the names of all nodes in the hierarchy prior and up to the node itself, concatenating the names of the component nodes using a dot '.' as a delimiter. For example, consider the following:

class MyClass
{
	class InnerClass
	{
		func doSomething static
		{
		}
	}
}

The fully qualified name of the function declared above would be MyClass.InnerClass.doSomething (that is, assuming the class MyClass does not have a parent namespace). If MyClass was itself a member of the namespace "mystuff", then the fully qualified name would be mystuff.MyClass.InnerClass.doSomething.

Statements are group inside "blocks" of code, and are treated as a sequential list of "commands" that the program executes one after the other.

Expressions are used in many parts of programs including as components of statements, variable values and as default values for function parameters. An expression always returns a value of a specific data type, depending on the expression and its parameters, and is often composed of a number of "sub-expressions" connected to each other via operators (see below).

Control structures are in charge of controlling the program flow and execution, used to mark the decisions of where the program execution should flow, and based on what conditions.

A literal is an expression that specifies a "hard-coded" value that is written by the programmer and the value itself "literally" is written as a part of the source code. There are different kinds of literals based on the type of the data contained therein, eg. "string literals", "integer literals", etc. (see below)

Primary expressions are fundamental expressions that can be combined together through the use of operators to form more complicated expressions.


Twitter Facebook LinkedIn Youtube Slideshare Github