Vikari Language Documentation


Available since:  v0.5.4.

Comments

Comments are tokens that are elided completely from the parser and interpreter phases. These are used to add notes about the implementation of a certain section of code, just as comments are used in any other programming language. Comments begin with ~: and end with :~. Comments can be either single-line or multiline. Comments can be nested.

Because comments can be nested, blocks of code containing closed comments can be commented out by enclosing the entire section with ~: at the start and :~ at the end. Comments that do not close every ~: token with a matching :~ token will comment out all code all the way to the end of the file or Vikari code snippet.

Comments can be interspersed with ordinary Vikari code. They can begin, exist in the middle of, or end a statement. Comments that intersect a statement work as line continuations if they are a multiline comment.

Examples

The following demonstrates various usages of comments.

~:This is a single-line comment.:~

~:This is a comment that spans
across two lines.:~

~:
The opening and closing tokens
can exist on their own line
and still be a valid comment.
:~

~:This is an outer comment ~:that
encloses an inner comment:~ within
its bounds.:~

~:
~:This comment encloses a comment
as well as valid Vikari code.:~
foo:Integer << 22
:[foo / 7.0]:
:~

The following demonstrates comments interspersed with Vikari code.

~:A comment may be on a separate line from a Vikari statement.:~
foo:AtonementCrystal << 2

~:A comment may begin a statement.:~ :foo:
:[foo + 2] ~:A comment may end a statement.:~

foo:Integer << [5 + 22 ~:A multi-line comment
functions as a line continuation:~ / 7.0]:

~:A statement:~ bar ~:may contain:~ : ~:as many:~
Float ~:comments:~ << ~:as you:~ 6.28 ~:desire.:~