Skip to content

Repository files navigation

C✨ v2.0 Codename "Loki"

C* is a block-based programming language where commands are written in quotes. Inspired by HolyC by Terry Davis.

Quick Install

Linux

curl -sSL https://raw.githubusercontent.com/insanityvrr-dot/cstar/main/install.sh | bash

Windows

Download install.bat from the Releases page, then right-click > Run as Administrator. It will build C* and add it to your PATH.

From Source

Linux:

git clone https://github.com/insanityvrr-dot/cstar.git
cd cstar
make

Windows (requires MinGW-w64 in PATH):

git clone https://github.com/insanityvrr-dot/cstar.git
cd cstar
build.bat

Usage

Starcommandv1 <file.star>           # Run a .star file
Starcommandv1 -e "print Hi"         # Execute inline
Starcommandv1 -i                    # Interactive REPL
Starcommandv1 -l <file.star>        # Show tokens
Starcommandv1 -p <file.star>        # Show AST
Starcommandv1 -v                    # Version
Starcommandv1 -h                    # Help

Language Syntax

Blocks

{
    "print Hello World"
    "echo This is a shell command"
}

Commands in Quotes

Each command is a quoted string that performs one action:

{
    "print Hello World"
    "echo Current user"
    "ls -la"
}

Comma Chaining

Multiple commands on one line separated by commas:

{
    "print Hello", "print World"
    "echo First", "echo Second"
}

Indented Sub-commands

After a command, indent for sub-commands or parameters:

{
    "print Hello"
        ("print This is a sub-command")
}

Parenthesized Sub-commands

Double indent in parentheses for time, color, or sub-commands:

{
    "print Starting..."
        ("await-(1s)")
    "print Done!"
}

Timing

Wait for specified duration:

{
    "print Starting..."
    "await-(1s)"
    "print 1 second later"
    "await-(500ms)"
    "print 500 milliseconds later"
    "await-(2m)"
    "print 2 minutes later"
}

Variables

{
    "set x = 10"
    "set name = C* Language"
    "print Value: {x}"
    "print Name: {name}"
}

Shell Commands

Execute system commands directly:

{
    "shell pwd"
    "shell whoami"
    "shell ls -la"
    "shell uname -a"
}

Built-in Commands

  • print <text> - Print to console
  • await-<duration> - Wait (1s, 500ms, 2m, 1h)
  • set <name> = <value> - Set variable
  • shell <command> - Execute shell command
  • type <value> - Get type
  • len <value> - Get length

String Interpolation

{
    "set name = World"
    "print Hello, {name}!"
}

Control Flow

{
    "set x = 10"
    "if x > 5"
        ("print x is large")
    "else"
        ("print x is small")
    "while x > 0"
        ("print {x}")
        ("set x = x - 1")
}

Functions

{
    "func greet(name)"
        ("print Hello, {name}!")
    "greet(World)"
}

Classes

{
    "class Person"
        ("init(name) { this.name = name }")
        ("greet() { return \"Hi, I am {this.name}\" }")
    "set p = Person(Alice)"
    "print {p.greet()}"
}

Examples

See the examples/ directory:

  • hello.star - Hello World
  • timing.star - Delay/timing features
  • shell.star - Shell commands
  • variables.star - Variable usage
  • fib.star - Fibonacci sequence
  • calculator.star - Calculator
  • classes.star - Object-oriented programming
  • audio.star - Play audio via shell

File Extension

C* programs use the .star file extension.

Requirements

  • A C++17 compiler (g++ recommended)
  • Linux, macOS, or Windows (MinGW-w64)

License

C* Language - Version 1.0.0 (Starcommandv1)

About

C* Programming Language — a block-based language inspired by HolyC

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages