Doo:一种基于Rust和LLVM的简单快速编程语言

1作者: nynrathod16 天前原帖
嘿,HN!<p>https://github.com/nynrathod/doolang<p>我是Nayan,我很高兴能分享我的项目Doo,这是一个简单易写但功能强大的编程语言。想象一下,干净的语法(受Rust启发,但更少的样板代码)、通过引用计数实现的自动内存管理(没有垃圾回收暂停)、丰富的数据类型,并且它通过LLVM/Clang生成独立的本地二进制文件。<p>为什么选择Doo?编程应该是有趣的,而不是令人头疼的。不再需要为获得一个“你好,世界”而与生命周期或宏进行斗争,同时仍然保持安全和快速。<p>快速演示(hello.doo):<p>fn main() { let msg = "嘿,HN!"; print(msg); }<p>静态类型系统:编译时类型检查与类型推断 自动内存管理:数据类型的引用计数 丰富的数据类型:整数、字符串、布尔值、数组、映射和元组 模块系统:使用层次化导入系统组织代码 控制流:条件语句、for循环和范围迭代 函数系统:具有参数和返回类型注释的一等函数 本地编译:使用clang/lld编译为独立可执行文件<p>仓库: https://github.com/nynrathod/doolang(欢迎点赞和提PR!)<p>你觉得怎么样?太像Rust了吗?缺少什么杀手级特性吗?
查看原文
Hey HN!<p>https:&#x2F;&#x2F;github.com&#x2F;nynrathod&#x2F;doolang<p>I&#x27;m Nayan, and I&#x27;m stoked to share Doo, my project turned side hustle for a lang that&#x27;s dead simple to write but punches like Rust. Think clean syntax (inspired by Rust but less boilerplate), auto memory mgmt via ref counting (no GC pauses), rich types, and it spits out standalone native bins via LLVM&#x2F;clang.<p>Why Doo? Coding should feel fun, not fighty. No more wrestling with lifetimes or macros just to get a &quot;hello world&quot; but still safe and speedy.<p>Quick tour (hello.doo):<p>fn main() { let msg = &quot;Hey HN!&quot;; print(msg); }<p>Static Type System: Compile-time type checking with type inference Automatic Memory Management: Reference counting for data types Rich Data Types: Integers, strings, booleans, arrays, maps, and tuples Module System: Organize code with a hierarchical import system Control Flow: Conditional statements, for loops, and range iteration Function System: First-class functions with parameter and return type annotations Native Compilation: Compiles to standalone executables using clang&#x2F;lld<p>Repo: https:&#x2F;&#x2F;github.com&#x2F;nynrathod&#x2F;doolang (stars&#x2F;pulls welcome!)<p>What do you think? Too Rust-y? Missing a killer feature?