Hemashushu’s Homepage

Curiosity, exploration and creation

XiaoXuan Programming Language

XiaoXuan Language is a full-stack programming language that allows you to learn one language to develop all kinds of programs.

Currently, it can be used to develop a variety applications, including digital circuits and chips, microcontroller firmware, GPU shaders, system programs, local native programs, cloud native programs, web applications and more.

XiaoXuan Language achieves this by providing multiple backends and variants, all of which follow the same syntax and design philosophy. This frees developers from the burden of learning multiple programming languages and tools.

Check out the features and syntax of XiaoXuan Language.

Variants

XiaoXuan Language consists of the following variants:

  • Build powerful user-space system programs that have extremely fast startup speed and small memory footprint, it can directly call syscall and interoperate with C shared libraries. Single-file, statically linked runtime make applications highly portable.
  • Build high-performance, solid web applications. It can be compiled to WebAssembly on-the-fly without the need for any build tools. It is intended to be the next preferred programming language for web development.
  • Build extremely secure, robust, truly portable and responsive programs, including desktop applications, cloud-native applications (such as microservices and serverless functions etc.), business systems, data science and A.I. programs and more. Each program runs in its own isolated environement, eliminating the need for containers. Applications do not need to be installed, they can be run with just a URL.
  • A memory-safe, general-purpose programming language inspired by Rust. It is designed to be simpler than Rust while it still provides automatic memory management without garbage collection, and avoids complex concepts such as ownership, borrow checking, and lifetimes. It aims to replace Rust in certain non-critical scenarios. It currently supports compiling to native code for architectures x86-64, aarch64 (ARM64), riscv64 and s390x (IBM Z), and will supports loongarch64 in the future.
  • Build high-performance firmware for microcontrollers (MCUs) easily, the built-in micro VM makes it possible to "write once, run anywhere", build IoT applications in a more modern way.
  • A brand new and modern hardware description language (HDL) that lets you design hardware and chips in the same ease and collaboration as open-source software. Its built-in GPU-accelerated simulator dramatically enhances test efficiency, saving you valuable time and resources.
The XiaoXuan Language Family

The XiaoXuan Language Family

Localization

The XiaoXuan Language supports writing code in local languages, such as Chinese, Japanese and French. In addition to keywords, the standard library and related documentation are also translated into local languages. Using local language programming is beneficial for children, beginners and non-computer majors who are not native English speakers.

XiaoXuan Local Languages

The XiaoXuan Local Languages

The local languages:

XiaoYu Operating System

I have also designed two new operating systems, one for daily use by engineers and the other for microcontrollers. Both are implemented using XiaoXuan Lang.

  • A brand new operating system built for the modern engineer's daily workflow. Every application runs in secure, isolated environement with minimal privileges, requesting permissions only when needed. This also ensures a pristine system, even after years of use, free from accumulated clutter or hidden processes. XiaoYu OS empowers developers to directly maintain their applications, eliminating the need for dedicated package maintainers.
  • A true operating system (not RTOS) for microcontrollers (MCUs). Applications (firmware) can be run by simply downloading and configuring, without the need to install development tools or compilation. Applications even run in a micro container. It completely changes the way firmware is developed and deployed.

Platform Support

XiaoXuan Lang is a newly designed programming language that has its own IR add assembly language. It does not rely on traditional compilation tools and shared libraries, such as GCC and LLVM. Therefore, XiaoXuan Lang (and XiaoYu OS, which is mainly developed using XiaoXuan Lang) has faster support for newer platforms such as RISC-V and LoongArch.

XiaoXuan Lang and XiaoYu OS hope to become the preferred programming language and operating system for new platforms.

Platform Support

Click here to view detailed platform support information

Hardware

I am sharing my open-source hardware here, including the hardware schematics, PCB documents, and manuals.

  • A very simple debugger (programmer) base on CMSIS-DAP implemented using a low cost MCU STM32F042 and very few parts. Used for downloading firmware to other MCUs or debugging programs.
  • A reference board for XiaoXuan Micro development. It uses a low-cost MCU STM32F030C8T6/STM32F072CBT6 in LQFP package, which is easy to make and hand soldering by yourself.
  • A reference board for XiaoYu Micro OS development. It integrates a debugger as well as numerous interfaces, buttons and LEDs using the common MCU STM32F412/STM32F411.

Check out more hardware.

Feature Manuals & Tutorials

  • M01 - The XiaoXuan Programming Language Reference

    Syntax, fundamental, and the standard library
    2023-04-16
    • Data types and Literals
    • Variables
    • Functions
    • Collection
    • Control Flow
    • Error Handling
    • Method, Generic and Interface
    • Pattern
    • Chain
    • Modules, Packages and Properties
    • Annotations and IoC
    • Macro
  • S80 - Zero to OS: Building Your Own Usable Operating System, Volumn 1: The User Space

    Build the user-space part of an OS for RISC-V platform from scratch in XiaoXuan Core
    2023-10-12
    • Set up a RISC-V virtual machine using QEMU.
    • Write a minimal init program.
    • Write a minimal shell program.
    • Fundamentals of file system and processes, implementing the pwd and ls commands.
    • Implement the mount and umount commands.
    • Principals of redirect, implementing the echo and cat commands.
    • Principal of pipe, implementing the tee and tr commands.
    • Session and process groups.
    • The root privileges, users and groups, and the setuid bit.
    • Add support for shell scripts.
  • S71 - Designing a Runtime Virtual Machine (VM) for Systems Programming

    The memory, stack and the concurrency model of XiaoXuan Core VM
    2023-06-13
    • Data types and thoughts on floating-pointer numbers
    • The triadic stack
    • Using indexes instead of pointer
    • The instruction set
    • Using structured blocks instead of jumps for control flow
    • Tail call optimization
    • Environment calls
    • System calls
    • Bridge functions and external calls
    • A Data-race-free parallel Model
  • S83 - Building a KVM-based Virtual Machine Tool Using XiaoXuan Native

    Linux KVM, kernel, and virtual device I/O
    2024-02-01
    • Comparison of CPU virtualization, simulators, and containers.
    • Creating a minimal virtual machine using the KVM API
    • Creating a virtual serial port device
    • Creating a virtual block device
    • Building a minimal kernel and a simple userspace program
    • Guide to booting a Linux kernel
  • S81 - Zero to OS: Building Your Own Usable Operating System, Volumn 2: The Kernel

    Write a simple kernel in XiaoXuan Native for RISC-V platform
    2024-02-06
    • RISC-V QEMU boot process and basic input/ouput
    • Creating a bare-metal "Hello, World" program
    • CPU interrupts and task switching
    • Multi-level page tables
    • Creating a simple file system
    • Pipes: Inter-process communication
    • Creating a simple shell
  • S90 - Building Your Own Linux-Capable CPU: A Step-by-Step Guide

    Design a RISC-V CPU core using XiaoXuan Logic
    2024-02-08
    • Digital circuit fundamentals: combinational and sequential circuits
    • Building a Blinky circuit, and interacting with the visual simulator
    • Synthesizing and downloading to FPGA hardware (Optional)
    • Introduction to RISC-V Instruction Architecture
    • Instruction decoder
    • Register File and Arithmetic Logic Unit (ALU)
    • Jump and branch instructions
    • Memory and load/store instructions
    • RISC-V calling convention ABI and implementing the functon calling
    • Memory mapping and implementing the UART peripheral
    • ROM and Building a simple program (firmware)
    • "Running" the CPU with XiaoXuan Logic visual simulator
    • Synthesizing and downloading to FPGA hardware (Optional)
    • Interacting via USB-UART and terminal on computer