Lever 是一个受 Minecraft 红石启发的微型深奥编程语言,使用 Python 实现,程序通过类似红石的组件来移动字节值。

Stars

2

7 天增长

暂无数据

Fork 数

0

开放 Issue

0

开源协议

MIT

最近更新

2026-07-30

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它将 Minecraft 红石概念转化为一个完整的解释器,包含词法分析器、递归下降解析器、抽象语法树、运行时、示例和单元测试,并且只依赖 Python 标准库。

适合谁使用

  • 编程语言爱好者和深奥编程语言(esolang)爱好者
  • 对红石式编程感兴趣、喜欢 Minecraft 的玩家
  • 想了解解释器实现原理的 Python 开发者
  • 希望用有趣方式讲解语言设计的教师或学习者

典型使用场景

  • 体验受红石启发的语法和面向字节的编程
  • 学习解释器的各个组成部分:词法分析、语法分析、AST 与运行时
  • 通过小语言演示 ASCII/字节处理以及带条件的终端输入
  • 借助有文档和测试的代码库来讲解语言设计

项目优势

  • 没有第三方 Python 运行时依赖
  • 包含可运行示例以及针对词法、语法和运行时的单元测试
  • 项目结构清晰,有源码、测试和语言规范文档
  • 支持输入观察器、多种存储类型以及红石式指令

使用前须知

  • 需要 Python 3.12 或更高版本
  • 属于深奥且面向字节的语言,不适合通用编程
  • 示例主要处理文本输入和 ASCII/字节值
  • 是独立项目,与 Mojang/Microsoft 无关联

README 快速开始

Lever

Lever is a small, esoteric programming language inspired by Minecraft Redstone. Programs move byte values through Redstone-inspired components such as chests, hoppers, dust, repeaters, observers, comparators, pistons, and lamps.

The interpreter is written in Python and includes a lexer, recursive-descent parser, abstract syntax tree, runtime, stack-based storage, examples, and unit tests.

[!IMPORTANT] Disclaimer

Lever is an independent programming language inspired by Minecraft's Redstone mechanics and terminology. It is not affiliated with, endorsed by, sponsored by, or associated with Mojang Studios or Microsoft. Minecraft is a trademark of Microsoft/Mojang.

Requirements

  • Python 3.12 or newer
  • A terminal capable of reading standard input
  • No third-party Python packages

Check your installed Python version with:

python --version

On Windows, the Python Launcher can be used to select a specific version:

py -3.12 --version

Setup

Clone or download the project, then open a terminal in the project directory.

Windows PowerShell

py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1
python --version

If the py launcher is not available, use the Python executable directly:

python -m venv .venv
.\.venv\Scripts\Activate.ps1

PowerShell may require permission to run activation scripts. If activation is blocked for your user account, run PowerShell once with the following command and then activate the environment again:

Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

macOS and Linux

python3.12 -m venv .venv
source .venv/bin/activate
python --version

The project has no runtime dependencies to install. When finished, leave the virtual environment with:

deactivate

Run a program

Run the interpreter as a Python module from the project root:

python -m src.main examples/hello.lever

Programs must use the .lever extension. The interpreter reports syntax and runtime errors in the terminal and returns a non-zero exit status when execution fails.

Examples

Hello world bytes

examples/hello.lever demonstrates storing ASCII bytes in a Chest, transferring them in valid Hopper batches, and printing them with Slime_Piston:

RedstoneBlock hello.lever

Chest 33,100,108,114,111,87,32,111

项目描述

Lever is a Minecraft-inspired programming language.

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

lopopolo
精选
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI 与机器学习AI 智能体
2,390
slvDev
精选
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI 与机器学习大语言模型
1,960
littledivy
精选
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI 与机器学习
1,482