On this page:
2.1 Identifiers
2.2 Numeric literals
2.3 String literals
2.4 Comments
7.4

2 Lexical syntax

2.1 Identifiers

Names, used for variables, functions, structs, classes, interfaces, fields, and methods, must start with a letter, followed by 0 or more letters or digits. The last character also may be ? or !.

2.2 Numeric literals

Numeric literals include:

2.3 String literals

String literals are delimited by either single or double quotes:

def does_not_matter(double):
    if double:
        return "This is the same string."
    else:
        return 'This is the same string.'

The contents of each kind of string is treated the same, except that each kind of quotation mark can contain the other kind unescaped:

def does_matter(double):
    if double:
        return "This isn't the same string."
    else:
        return '"This is not the same string" isn\'t the same string.'

Strings cannot contain newlines directly, but can contain newline characters via the escape code \n. Other escape codes include:

Any other character following a backslash stands for itself.

An alternative form for string literals uses three quotation marks of either kind. The contents of such a string are treated literally, rather than interpreting escapes, and they may contain any characters except the terminating quotation mark sequence.

let a_long_string = '''This string can contain ' and " and
even """ and newlines. Just not '' and one more.'''

2.4 Comments

A comment in DSSL2 starts with the # character and continues to the end of the line.

Long string literals can also be used to comment out long blocks of code.