MCPcopy Index your code
hub / github.com/ClueLang/Clue

github.com/ClueLang/Clue @v3.4.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.4.7 ↗ · + Follow
269 symbols 979 edges 11 files 81 documented · 30% updated 12mo agov3.4.7 · 2024-03-29★ 37917 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

The Clue programming language

image
Crates.io Crates.io GitHub AUR

Clue is a programming language that compiles blazingly fast into Lua code with a syntax similar to languages like C or Rust.

Clue tries to be almost as simple as Lua (with only a slightly more advanced syntax) but adds many optional features that can make code look better or make some things (like metatables) easier to code.

Clue does not compile to a specific version of Lua: flags can be toggled to alter the output to allow most if not all versions or modifications of Lua to be compiled to with Clue.

General syntax differences

  • Code blocks are now inside {} instead of then/do/repeat and end/until
  • Comments are made with // ... or /* ... */

If you want a complete documentation of every change and addition in Clue check the wiki.

Example code

@ifos linux {
    @define GREETING "Hello, Linux user "
} @else_ifos macos {
    @define GREETING "Hello, MacOS user "
} @else {
    @define GREETING "Hello, Windows user "
}

@macro GREET(target) { $GREETING .. $target .. "!" }

print($GREET!("Maiori"))

local fn add(x = 0, y = 0) {
    return x + y
}

global n = 1

while n < 10 {
    n += add($, $)
    match n {
        3 => {
            continue
        }
        4 if x => {
            break
        }
        default => {
            print(n < 3 ? n : -n)
        }
    }
}

More examples can be found in: - the wiki - the Examples directory - a game made with LÖVE - Clue's MessagePack library - a simple graph visualizer made with LÖVE

How to install

Using Cargo

  1. Paste and run this command in the console: cargo install clue
  2. Type clue in the console to run the compiler, it will explain the rest

Clue supports extra features that can be toggled when installing: * interpreter: adds the --execute flag to let Clue run the generated output using mlua * rpmalloc: uses rpmalloc to improve performance, not available on all platforms

By default Clue enables both features.

Using Linux packages

These can be downloaded in the latest release. * .deb

sudo dpkg -i clue_<version>_<arch>.deb
  • .rpm
sudo rpm -i clue-<version>.<arch>.rpm

Using the AUR

  • With paru
paru -S clue
  • With yay
yay -S clue
  • With makepkg
git clone https://aur.archlinux.org/clue.git
cd clue
makepkg -si

Manual installation

  1. Download the latest release and save it somewhere
  2. Open your system environment variables
  3. Add the path to the directory that contains clue.exe in the PATH variable
  4. Type clue in your cmd/PowerShell to run the compiler, it will explain the rest

More coming soon!

There are still features that I'm considering adding and others that will be added soon. The most likely ones to be added in the future are: - type system (coming in 4.0) - better error messages (comming in 4.0) - proper language server support (coming in 4.0)

For any suggestion or bug you can make a github issue. If you need help with the language itself, you can check out the Discord server.

I hope Clue will be useful to you :)

Why is Clue named Clue?

~~I have no clue.~~

Core symbols most depended-on inside this repo

line
called by 86
core/src/code.rs
push
called by 86
core/src/code.rs
kind
called by 52
core/src/scanner.rs
lexeme
called by 44
core/src/scanner.rs
column
called by 44
core/src/code.rs
peek
called by 41
core/src/parser.rs
len
called by 38
core/src/code.rs
to_string
called by 35
core/src/code.rs

Shape

Method 208
Function 34
Class 18
Enum 9

Languages

Rust100%

Modules by API surface

core/src/parser.rs71 symbols
core/src/preprocessor.rs39 symbols
core/src/scanner.rs36 symbols
core/src/lib.rs28 symbols
core/src/code.rs27 symbols
wasm/src/lib.rs25 symbols
core/src/compiler.rs15 symbols
core/benches/bench.rs9 symbols
cli/src/threads.rs7 symbols
cli/src/main.rs7 symbols
core/src/env.rs5 symbols

For agents

$ claude mcp add Clue \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page