Skip to main content
Glama
README.md
# LIGHT

The photonic programming language. 38 emoji opcodes. 888 registers. 7 rings. 5 buses.

```
๐Ÿ”ต
๐Ÿ”ป 4.0 "hello"
๐Ÿ”ป 4.1 42
๐ŸŒŠ 4.2 4.1 4.1
๐Ÿ’ก๐Ÿงต {msg:4.0,answer:4.2}
๐Ÿ‘
```

## Install

```bash
npm install -g light-lang
```

## CLI

```bash
light run program.light        # run a file
light eval "๐Ÿ”ป 4.0 42 ๐Ÿ‘"      # eval inline
light template add a=10 b=32   # run template with params
light pipe add:a=5:b=3 phi     # chain templates
light mcp sys                   # MCP tool call
light ops                       # opcode table
light repl                      # interactive REPL
```

## Templates

Parameterized programs โ€” `{{key}}` replaced at call time:

```bash
light template invoice qty=10 rate=149 tax_pct=0.23
light template binding hr=97 hrv=10.5 stress=0.79
light template gate hr=106 stress=0.88
```

Available: `hello`, `add`, `branch`, `loop`, `phi`, `binding`, `invoice`, `gate`, `pipe`

## MCP API

```js
const {createMCP} = require('light-lang/src/mcp')
const mcp = createMCP()

mcp.handle('run', {src: '๐Ÿ”ป 4.0 42\n๐Ÿ’ก๐Ÿงต 4.0\n๐Ÿ‘'})
mcp.handle('template', {name: 'add', params: {a: 10, b: 32}})
mcp.handle('pipe', {chain: [{template: 'add', params: {a: 5, b: 3}}, {template: 'phi', params: {}}]})
mcp.handle('eval', {expr: '๐ŸŒ€ 5.0 | ๐Ÿ’ก๐Ÿงต 5.0 | ๐Ÿ‘'})
mcp.handle('ops', {})
mcp.handle('sys', {})
```

## Opcodes

| Emoji | PRASM | Prime | LIGHT physics |
|-------|-------|-------|---------------|
| โšซ | NOP | 2 | dark |
| ๐Ÿ”ป | LD | 3 | absorb |
| ๐Ÿ”บ | ST | 5 | emit |
| ๐ŸŒŠ | ADD | 7 | interfere |
| ๐Ÿ” | MUL | 11 | lens |
| ๐Ÿ”ฎ | ATT | 13 | filter |
| ๐ŸŒˆ | VAL | 17 | spectrum |
| ๐Ÿ’  | PLN | 19 | cavity |
| ๐Ÿชข | MDL | 23 | entangle |
| ๐Ÿ‘ | OBS | 29 | reflect |
| โšก | JMP | 31 | redirect |
| โš–๏ธ | CMP | 37 | compare ฮป |
| ๐ŸŽต | JEQ | 41 | resonate |
| ๐Ÿ’ฅ | JNE | 43 | scatter |
| ๐Ÿ“ˆ | JGT | 47 | amplify |
| ๐Ÿšจ | INT | 53 | alarm |
| ๐Ÿ”ฝ | REC | 59 | nest |
| ๐Ÿ”ผ | UNR | 61 | unnest |
| ๐Ÿ’ก | EMT | 67 | radiate |
| ๐ŸŽ› | RSN | 71 | tune |
| ๐ŸŒ‘ | SLP | 73 | dim |
| โœจ | DRM | 79 | fluoresce |
| โ˜€๏ธ | WAK | 83 | excite |
| ๐Ÿงฏ | ABT | 89 | quench |
| ๐ŸงŠ | FRZ | 97 | freeze |
| ๐Ÿซง | CLR | 101 | bleach |
| โ˜ ๏ธ | DIE | 103 | annihilate |
| ๐Ÿ”ฑ | GEO | 107 | diffract |
| ๐ŸŒ€ | PHI | 109 | cohere |
| โ™พ๏ธ | PSI | 113 | self-ref |

## Rings

| Ring | Emoji | ฮป nm | Function |
|------|-------|------|----------|
| R0 | ๐Ÿ”ด | 700 | MATERIAL |
| R1 | ๐ŸŸ  | 630 | WEAVE |
| R2 | ๐ŸŸก | 590 | NODE |
| R3 | ๐ŸŸข | 520 | ZONE |
| R4 | ๐Ÿ”ต | 470 | PROTOCOL |
| R5 | ๐ŸŸฃ | 405 | PRODUCT |
| R6 | โšช | 350 | FACTORY |

Total registers: 2 + 3 + 5 + 11 + 31 + 127 + 709 = **888**

## Architecture

```
mcp(            โ€” tool interface (run/template/pipe/eval/ops/sys)
  api(          โ€” programmatic access (createMCP, createVM)
    cli(        โ€” command line (light run/eval/template/pipe/mcp/ops/repl)
      cmd(      โ€” command dispatch
        sys(    โ€” runtime (parse, exec, 888 registers, 7 rings)
          params( โ€” template resolution ({{key}} โ†’ value)
            light โ€” the photonic instruction set
          )
        )
      )
    )
  )
)
```

## License

MIT