#编程语言 #ena #算法 #彻底 #臭名昭著 #docgen

enalang_docgen

彻底臭名昭著的算法 - docgen

2个不稳定版本

0.6.1 2023年12月20日
0.5.2 2023年11月6日

#301模板引擎


用于 enalang

GPL-3.0-only

14KB
320

ena

彻底臭名昭著的算法

Ena是一种非常糟糕的语言,其实现最初是用C编写的,但后来因为主要开发者厌倦了调试段错误而被重写为Rust。

安装

目前,Ena不提供预构建的二进制文件,您需要自己构建它。

Ena是用Rust编写的,因此您应该已经安装了cargorustc

构建和安装命令

# If you want a stable version
$ cargo install enalang

# If you have cloned the repo
$ cargo install --path ./enalang

测试您是否已安装Ena

$ ena --version

如果看到错误,请检查您的PATH变量是否配置正确。

语法

Ena是一种基于栈的语言。这意味着它在栈上工作。这听起来合理,不是吗?

展示比解释更容易。

Ena没有函数,它有块。唯一的区别是块不接收参数。相反,它从栈中获取它需要的参数。

# Comments are written in Python style.

# Let's print hello world.

# Main is the entrypoint of any ena program.
main {
    print_hello # Calls print_hello block.
}

# Let's define another block to call from main.
print_hello {
    "hello world!" # A literal puts the value on top of stack.
    println # println takes the literal on top of stack and prints it with a new line.
}

移除所有注释后,结果是一段非常短且整洁的代码。

examples文件夹中查看更多示例。

依赖项

~4.5–6.5MB
~127K SLoC