UwU: A cute esolang

From Esolang
Jump to navigation Jump to search
Not to be confused with UwU.

UwU is an esoteric programming language made by PhoenixHO. It is entirely based on UwU faces and UwU-fied english words. A fully functioning bytecode interpreter written in C++ can be found in the external resources.

Language features/syntax

Variables and data-types

UwU is a statically typed esolang that supports working with user-defined variables. It supports the following data-types:

  • Numbers (integers and decimal numbers)
  • Strings
  • Characters
  • Boolean

The syntax for defining a new variable is:

uwu variable_name

without the need to specify the data-type of the variable. To initialize a variable:

uwu variable_name := value

value can be any valid expression in UwU. UwU supports global as well as local variables. Local variables are variables that are declared within a block/scope (enclosed by [: and :]) and only accessible within that block.

Expressions

Bellow are some valid UwU expressions:

  • number literals (hex currently not supported)
  • character literals (enclosed by backticks `)
  • string literals (enclosed by quotation marks ")
  • boolean (twue or fawse)
  • unary/binary operations

Operators

Binary operators:

  • Addition +
  • Subtraction -
  • Multiplication *
  • Division /
  • Concatenation + (works with both character and string literals and the result is always a string)
  • Equality =, != (works with strings too)
  • Comparison <, <=, >, >=
  • Assignent :=

Unary operators:

  • Not !
  • Negation -

Logical operators:

  • awnd
  • ow

Comments

UwU supports only multiple line comments. The syntax for them is as follows:

{: This is a comment that will be entirely ignored :}

Statements

If-statements

The syntax for an if-statement in UwU is:

?w? condition [:
    {: code :}
:]

And the syntax for an if..else statement is:

?w? condition [:
    {: will execute if 'condition' is true :}
:] ewe [:
    {: will execute otherwise :}
:]

condition can be any UwU valid expression. UwU treats any non-zero value as truthy, while 0 is falsy.

Loops

The syntax for a loop in UwU is:

untiw condition [:
    {: will stop executing if 'condition' is true :}
:]

Print statements

The syntax for printing an expression is:

ouo expression >>

To print multiple expressions at once:

ouo expression1, expression2, ... >>

The new line character in UwU is ~n, while ~t corresponds to the tab character. So to print a new line or a tab:

ouo ~n >>

or,

ouo ~t >>

Reading input

Reading input is different for each data type. The syntax is:

iwi type variable_name <<

type can be:

  • -s for string literals
  • -d for number literals
  • -c for character literals

Functions

UwU supports both recursive and non-recursive functions. To define a function:

fwun function_name(parameter1, parameter2, ...) [:
    {: function body :}

    out return_value >>
:]

Parameters and return values are optional.

Examples

Hewwo Wowwd!

ouo "Hewwo Wowwd!" >>

Twuth-machine

uwu input
iwi-d input <<

untiw input = 0 [:
    ouo 1, ~n >>
    iwi-d input <<
:]

External resources