Uartix Programming Language

/wor·tiks/

Strange dynamic programming and scripting language that performs mathematical computations on a connected Raspberry Pi Pico (RP2040) through UART connectivity.




Why Uartix?

Despite its unconventional and dynamic behavior, as well as its lack of fundamental APIs, Uartix can still serve as a general-purpose programming and scripting language. The following points outline the reasons behind the development of Uartix:

  • The Raspberry Pi Pico, with its dual-core ARM Cortex-M0+ processor, offers an irrelevant yet affordable platform for hardware-level computation.
  • Uartix provides a specialized environment where developers can perform mathematical operations directly on the hardware.
  • Compared to many external coprocessors, Uartix running on a Raspberry Pi Pico presents a highly cost-effective solution. The affordability of the Pico reduces overall project costs while still delivering substantial computational power for a variety of applications.
  • The Raspberry Pi Pico, with its energy-efficient ARM Cortex-M0+ cores, offers a low-power solution for performing mathematical calculations which is perfect for Uartix runtime execution.
  • Why not? I was bored when I started developing this.

Features

  • Rich expression and statement constructs

    The language includes standard control flow constructs such as if, while, and loop, as well as more specialized ones like unless, when, and random. These constructs enable developers to write clear and concise code that directly expresses their intent, reducing the need for verbose and boilerplate code.

  • Support for multiple numerical bases

    One of the standout features of Uartix is its support for multiple numerical bases, including binary, trinary, octal, and hexadecimal, in addition to standard decimal numbers.

  • In-code testing units

    Uartix introduces an innovative test statement that facilitates in-code testing and validation. This feature allows developers to embed tests directly within their codebase, providing a streamlined approach to verifying functionality and ensuring code correctness. The test statement is particularly useful for unit testing, where individual components of the code can be tested in isolation.

  • Control Flow as Expressions

    A distinctive feature of Uartix is its treatment of control flow constructs as expressions rather than traditional statements. This design choice enhances the language's expressiveness and flexibility, allowing control flows to be used as part of larger expressions.

  • Boolean Constructs: true, false, and maybe

    Uartix introduces unique boolean constructs true, false, and maybe, which add a layer of versatility and unpredictability to the language's logic handling. While true and false are standard boolean values, maybe is a distinctive feature that represents an uncertain or probabilistic state, which is resolved at runtime.


Your First Program

The Hello World program in Uartix demonstrates the basic syntax and functionality of the language, showcasing how to define and call a function that generates a simple greeting message. This example introduces key concepts such as function definition, string concatenation, and function invocation, providing a foundation for more complex programs.

hello.utx

# Hello world example

greet = func(name)
    render "Hello, " + name;

greet("world");

The line greet = func(name) defines a function named greet that takes a single parameter, name. In Uartix, the func keyword is used to declare a function. The assignment greet = func(name) binds this function to the identifier greet, allowing it to be called later in the program. The parameter name represents the input that the function will receive when it is called.

Within the function body, which is indicated by the indentation following the function definition, there is a single statement: render "Hello, " + name;. This line uses the render keyword, which is a command in Uartix to output text to the console or display. The expression "Hello, " + name demonstrates string concatenation, where the literal string "Hello, " is combined with the value of the name parameter. The resulting string is then rendered or displayed as the output of the function.

Finally, the line greet("world"); calls the greet function with the argument "world". When this line is executed, the function greet is invoked, and the string "world" is passed as the parameter name. Inside the function, this parameter is used to create the greeting message. Consequently, the render statement outputs the concatenated string "Hello, world", which is the final result of the program.


Development Support

Uartix is an open-source project and is voluntarily developed. If you find Uartix useful and would like to support its continued development and improvement, you can make a donation.




Copyright 2024 © Nathanne Isip