A dialect of Lisp that designed for Minecraft bedrock command.

Overview

Command Lisp Document

​ Command Lisp是一门为Minecraft Bedrock设计的简化语言,拥有这非常高的抽象程度。同时,它也是Lisp的一门方言。

Lisp 与众不同的部分原因是,它被设计成能够自己进化。你能用 Lisp 定义新的 Lisp 操作符。当新的抽象概念风行时(如面向对象程序设计),我们总是发现这些新概念在 Lisp 是最容易来实现的。Lisp 就像生物的 DNA 一样,这样的语言永远不会过时。

为什么要使用Command Lisp (CL)?

​ 在Minecraft Bedrock中编辑命令有时候非常困难,不稳定的游戏代码也给我们造成了很多麻烦,而且很多命令非常不直观,大大降低了工作效率。CL的诞生就是为了解决这些痛点,使用它你能体会到如下诸多好处。

  • 一次编写,多处运行:你只需要使用CL完成命令编写,可以利用我们的工具导入多个存档,进而实现复用。
  • 高抽象,高效率:CL语言让你能够以更少的代码量实现更多的可能性
  • 简单易学,Lisp语言非常直观易懂
  • 减少错误:相比直接在命令系统寻找错误,在CL脚本中寻找错误显然更加简单

变量定义

​ CommandLisp有以下几种变量类型:

  • number 数字类型

  • string 字符串

  • atom 原子

    可以使用let来定义临时变量:

    (let (a 2)) ; a = 2
    (let (b "tell @e Secret Message!")(cmd b)) ; "tell @e Secret Message!"

    define则用于普通变量:

    2")(write "a <= 2")) ">
    (define a 2)
    (if (> a 2)(write "a > 2")(write "a <= 2"))

基本命令

  • tag+ : 给实体添加tag
  • tag- : 给实体移除tag
  • tag~: 判断实体存在某tag
(tag+ p "TAG_1") ;tag @p add TAG_1
(tag- r "TAG_2") ;tag @p remove TAG_2
(tag~ r "TAG_3") ;testfor @r[tag=TAG_3] ~ ~ ~ 
  • quote (')

    一个不遵守 Command Lisp 求值规则的操作符是 quotequote 是一个特殊的操作符,意味着它自己有一套特别的求值规则。这个规则就是:什么也不做。 quote 操作符接受一个实参,并完封不动地返回它。

    ;返回(tag+ p "TAG_3")
    (quote (tag+ p "TAG_3")) 
    ('(tag+ p "TAG_3")) 
  • cmd

    执行某个命令,不推荐使用,因为Command Lisp对大量命令都有封装

    (cmd "say Hello World") ;"say Hello World"
    (cmd "kill @e") ; "kill @e"
  • write

    标准聊天窗口输出

    (write "Hello World") ; [!]Hello World
  • tp

    Teleport命令

    (tp r r) ; "tp @r @r"
    (tp a p) ; "tp @a @p"

条件表达式

​ Command Lisp内置了一些方便的条件式,最简单的当然是if,它通常接受三个实参,一个 test 表达式,一个 then 表达式和一个 else 表达式。若 test 表达式求值为逻辑 ,则对 then 表达式求值,并返回这个值(通常是信号);若 test 表达式求值为逻辑 ,则对 else 表达式求值。

(if (test)(then)(else))
(if (tag~ a "TEST")(write "Found player marked for TEST")(write "No player has the TEST tag"))

CAIMEO注: 该语言只是我的一个小想法,但是我觉得非常有意思,如果反响不错的话我可能在近期推出它。上述文档仅仅介绍了语言的一小部分内容,还不能真正展现Lisp的全部魅力,也可能存在一些错误,毕竟本人不是CB圈子的人,写这个语言不过是为了学习Lisp和编译原理。当然,如果这份文档能够引起CB圈大佬的注意,那我也是非常开心的:)

You might also like...
Orion is a lisp dialect.
Orion is a lisp dialect.

Orion Orion is a lisp inspired statically typed programming language written in Rust Install From releases Download binary from the releases. With car

Milho (corn in portuguese) is a toy dialect of Lisp written as a way to learn more about compilers

Milho (corn in portuguese) is a toy dialect of Lisp written as a way to learn more about compilers. There are implementations in rust and go

A Minecraft Java Edition to Bedrock Edition resource pack convertor in Rust

j2be A Minecraft Java Edition to Bedrock Edition resource pack convertor in Rust How to use Note: This project is still in development Run cargo build

A powerful minecraft bedrock software written in Rust with a powerful Typescript plugin API.
A powerful minecraft bedrock software written in Rust with a powerful Typescript plugin API.

Netrex A powerful minecraft bedrock software written in RustLang. Why Netrex? It's written in Rust. Unique and straight to the point. Typescript Plugi

Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

1️⃣ el lisp number uno - one lisp to rule them all 🏆

luno el lisp number uno luno is the one lisp to rule them all. Still experimental, do not use it in production yet. goals embeddable small size simple

A server software designed for fetching Minecraft and Minecraft-related metadata

Minecraft Metadata Server A server software designed for fetching Minecraft and Minecraft-related metadata (such as Forge, Fabric, Quilt and Liteloade

A collection of compilers based around compiling a high level language to a Brainfuck dialect.
A collection of compilers based around compiling a high level language to a Brainfuck dialect.

tf A collection of compilers based around compiling a high level language to a Brainfuck dialect. Built at, and for, the VolHacks V hackathon during O

Pua-lang - a dialect of The Monkey Programming Language

pua-lang PUA Programming Language written in Rust. What's pua-lang? pua-lang is a dialect of The Monkey Programming Language, intended to mirror the i

A programming language designed for the DiamondFire Minecraft server.

Blackstone Blackstone is a programming language designed to help create plots on the MCDiamondFire Minecraft server. Community Links Discord: https://

Lisp but using indentations

Calcit Runner An interpreter for Calcit snapshot file. Home http://calcit-lang.org/ APIs http://apis.calcit-lang.org/ Running Calcit Editor with compa

Create evolving artistic images with hot-code-reloaded Lisp and GLSL.
Create evolving artistic images with hot-code-reloaded Lisp and GLSL.

Shadergarden is a tool for building hot-code-reloadable shader pipelines. For a tutorial for how to get started, consult the introductory

Lisp-style programming language

Bobbylisp A programming language, syntax are like mal and clojure. This project follow mal guides, Planning to add some more features after finishing

Lisp and Rust in a text editor = Crispmacs

crispmacs crispmacs is a WIP implementation of Emacs from scratch in Rust. It consists of two parts: crisp and the editor. Crisp crisp is a Lisp that'

Lisp interpreter that might be fast someday maybe?

ehlisp Pronunciation I'm not really sure. Maybe like an incorrect pronunciation of "ellipse", like "ellisp"? Also maybe like "a lisp". I named it this

Compiler from a lisp-like language to mlog

slimlog slimlog compiles a lisp-like language to mlog Architecture slimlog is divided into three distinct parts Parser Parses the source file Compiler

A simplistic functional programming language based around Lisp syntax.

Orchid A simplistic functional programming language based around Lisp syntax. Short taste # function to return the larger list (fn larger-list (as bs)

An interpreted LISP-like language. Made in Rust.

RISP Warning: The language is a work in progress. It's lacks many features and might not be stable. RISP is an interpreted LISP-like language. It's wr

Owner
CAIMEO
More is different.
CAIMEO
Lisp but using indentations

Calcit Runner An interpreter for Calcit snapshot file. Home http://calcit-lang.org/ APIs http://apis.calcit-lang.org/ Running Calcit Editor with compa

Calcit 63 Dec 26, 2022
Lisp-style programming language

Bobbylisp A programming language, syntax are like mal and clojure. This project follow mal guides, Planning to add some more features after finishing

azur 36 Dec 19, 2022
Lisp interpreter that might be fast someday maybe?

ehlisp Pronunciation I'm not really sure. Maybe like an incorrect pronunciation of "ellipse", like "ellisp"? Also maybe like "a lisp". I named it this

Eddie Hatfield 3 Oct 6, 2022
Sol is a lightweight language primarily designed for scripting environments

☀️ Sol A dynamically-typed (for now) and procedural programming language. About Sol is a lightweight language primarily designed for scripting environ

Joshua 3 Jul 25, 2022
Ethereal - a general-purpose programming language that is designed to be fast and simple

Ethereal is a general-purpose programming language that is designed to be fast and simple. Heavly inspired by Monkey and written in Rust

Synthesized Infinity 21 Nov 25, 2022
ruby-build is a command-line utility that makes it easy to install virtually any version of Ruby, from source.

ruby-build ruby-build is a command-line utility that makes it easy to install virtually any version of Ruby, from source. It is available as a plugin

null 3.7k Jan 5, 2023
zzhack-cli is a Command Tool to help you quickly generate a WASM WebApp with simple configuration and zero code

English | 中文文档 zzhack-cli is a Command Tool that can help you quickly generate a WASM WebApp with simple configuration and zero code. It's worth menti

null 17 Feb 9, 2023
A command-line tool for extensible LED matrix control with Raspberry Pi devices.

Matricks "Teach an old matrix new tricks..." Matricks is a WASM-based extensible LED matrix control tool intended for use on Raspberry Pi devices. LED

Will McGloughlin 3 May 1, 2023
☘️ A simple command line tool to manage your Minecraft Bedrock worlds

☘️ Haze A simple command line tool to manage your Minecraft Bedrock worlds Haze allows you to keep your project's worlds out of the com.mojang directo

Sedge 3 Dec 8, 2022
Lisp dialect scripting and extension language for Rust programs

Ketos Ketos is a Lisp dialect functional programming language. The primary goal of Ketos is to serve as a scripting and extension language for program

Murarth 721 Dec 12, 2022