Veeyu Primer

This documentation is an introduction to the Veeyu programming language for programmers.

Strings

<string> objects have several useful methods and properties:

>>> "hello"
"hello"
>>> s := 'Veeyu language'
"Veeyu language"
>>> s.split(" ")
["Veeyu", "language"]
>>> "hello, " ++ "world!"
"hello, world!"
>>> "abc"[0]
c"a"
>>> "veeyu".make-uppercase()
"VEEYU"
>>> "hello world"[2 ~ 7]
"llo w"
>>> "veeyu" as <list>
[c"v", c"e", c"e", c"y", c"u"]

Literals

There are four types of string literals:

string e.g. "like this"

This is the most commonly used string literal. It accepts C-style metacharacters like \n, \r, \t and Python-style metacharacters that represents unicode codepoints like \xff, \uffff, \Uffffffff.

See also

Metacharacters

Raw string e.g. 'like this'
This is a raw string literal that doesn’t take any metacharacters except \'. For example, '\'this\'\ncode\\' equals to "'this'\\ncode\\\\".

Multiline string e.g. """like this"""

See also

Metacharacters

Multiline raw string e.g. '''like this'''

Metacharacters

Escaping Sequence Meaning
\\ Backslash (\)
\' Single quote (')
\" Double quote (")
\a ASCII Bell (BEL)
\b ASCII Backspace (BS)
\f ASCII Formfeed (FF)
\n ASCII Linefeed (LF)
\r ASCII Carriage Return (CR)
\t ASCII Horizontal Tab (TAB)
\uxxxx Unicode character with 16-bit hex value xxxx
\Uxxxxxxxx Unicode character with 32-bit hex value xxxxxxxx
\v ASCII Vertical Tab (VT)
\xhh Unicode character with hex value hh

Numbers

>>> 1 + 2 + 3
6

There are some numeric types according to standards:

  • <number>
    • <integer>
    • <decimal>

Implementations may add some subclasses for numeric types for performance optimization or ease of implementation, so Comedy implements <int> and <long> classes that have the common superclass <integer> and match to Python’s int and long classes.

  • <number>
    • <integer>
      • <long>
      • <int>
    • <decimal>
>>> 1.class
<int>
>>> 999999999999999999.class
<long>
>>> 1 isa? <integer>
true
>>> 999999999999999999 isa? <integer>
true

Project Versions

Table Of Contents

Previous topic

Comedy

Next topic

comedy — A naive Veeyu implementation

This Page