当前位置: 首页 > 软件库 > 开发工具 > 编译器 >

nelua-lang

授权协议 MIT License
开发语言 C/C++
所属分类 开发工具、 编译器
软件类型 开源软件
地区 不详
投 递 者 锺离逸春
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Nelua Logo

nelua.io

Test StatusDiscord

Nelua (stands for Native Extensible Lua) is a minimal, efficient,statically-typed and meta-programmable systems programming language heavilyinspired by Lua, which compiles to C and native code.

Note: The language is in alpha state and still evolving.

Quick start

  • For basic information check the Website.
  • For first steps and how to use Nelua, start at the Tutorial.
  • For a tour of the language's syntax, features and usage read the Overview.
  • For small examples written in Nelua look the Examples folder .
  • For questions and discussions go to the Discussions.
  • For a chat with the community join the Discord server.
  • For cool stuff made with Nelua check Awesome Nelua repository and #showcase channel in the Discord server.

After installing, you might want to check out the featured example, a Snakegame leveraging the famous SDL2 library:

nelua examples/snakesdl.nelua

About

Nelua is a systems programming languagefor performance-sensitive applications where Luawould not be efficient, such as operating systems, real-time applications andgame engines. While it has syntax and semantics similar to Lua, it primarilyfocuses on generating efficient C code and provide support forhighly-optimizable low-level programming. Using Nelua idioms such as records,arrays, manual memory management and pointers should result in performance asefficient as pure C; on the other hand, when using Lua idioms such as tables,metatables and untyped variables, the compiler will bake a runtime library forthis sort of dynamic functionality into the program, which could incur someruntime overhead.

Nelua can do meta programmingat compile time through preprocessor constructs written in Lua; since thecompiler itself is also written in Lua, it means that user-providedpreprocessor code can interact at any point with the compiler's internals andthe source code's AST.Such system allows for ad-hoc implementation of high level constructs such asclasses,generics andpolymorphism,all without having to add them into the core specification, thus keeping thelanguage simple, extensible and compact. The same way that Lua'sobject-oriented patterns are not built into the language, but can benonetheless achieved through metatables,in Nelua you could yourself implement a similar functionality which is fullydecided at compile time or dynamically dispatched at runtime.

Nelua can do extensible programmingas the programmer may add extensions to the language such as new grammars,AST definitions,semantics, type checkers, code generation and behaviors to the compiler atcompile time via the preprocessor.

Nelua provides support for both garbage-collectedand manualmemory management in a way that the developer can easily choose betweenusing garbage collection, or completely disablinggarbage collection, or mixing both.

Nelua first compiles toC, then it executes aC compiler to produce native code.This way existing C code and libraries can be leveraged and new C libraries canbe created. Another benefit is that Nelua can reach the same target platformsas C99 compilers, such GCCor Clang, while also enjoyingstate-of-the-art compiler optimizations provided by them.

The initial motivation for its creation was to replace C/C++ parts of projectswhich currently uses Lua with a language that has syntax and semantics similarto Lua, but allows for fine-grained performance optimizations and does not losethe ability to go low level, therefore unifying the syntax and semantics acrossboth compiled and dynamic languages.

Goals

  • Be minimal with a small syntax, manual and API, but powerful
  • Be efficient by compiling to optimized C code then native code
  • Have syntax, semantics and features similar to Lua
  • Optionally statically typed with type checking
  • Achieve classes, generics, polymorphism and other higher constructs by meta programming
  • Have an optional garbage collector
  • Make possible to create clean DSLs by extending the language grammar
  • Make programming safe for non experts by doing run/compile-time checks and avoiding undefined behavior
  • Possibility to emit low level code (C, assembly)
  • Be modular and make users capable of creating compiler plugins to extended
  • Generate readable, simple and efficient C code
  • Possibility to output freestanding code (dependency free, for kernel dev or minimal runtime)
  • No single memory management model, choose for your use case GC or manual

Why?

  • We love to script in Lua.
  • We love C performance.
  • We want best of both worlds in a single language and with a unified syntax.
  • We want to reuse or mix existing C/C++/Lua code.
  • We want type safety and optimizations.
  • We want to have efficient code while maintaining readability and safety.
  • We want the language features and manual to be minimal and fit our brain.
  • We want to deploy anywhere C runs.
  • We want to extended the language features by meta programming or modding the compiler.
  • We want to code with or without garbage collection depending on our use case.
  • We want to abuse of static dispatch instead of dynamic dispatch to gain performance and correctness.

Contributing

You can support or contribute to Nelua in many ways,giving the project a star on github,testing out its features,reporting bugs,discussing ideas,helping other users,spreading it to the world,sharing projects made with it on github,creating tutorials or blog posts,improving its documentationor through a donation or sponsorship.

Nelua is open source,but not very open to contributions in the form of pull requests,if you would like something fixed or implemented in the core languagetry first submitting a bug report or opening a discussion instead of doing a PR.The authors prefer it this way, so that the ideal solution is always provided,without unwanted consequences on the project, thus keeping the quality of the software.

Read more about contributing in the contributing page.

Become a Patron

License

MIT License

 相关资料
  • 问题内容: 阅读Loom提案后提出了这个问题,该提案描述了用Java编程语言实现协程的方法。 特别是,该提案表示,要以该语言实现此功能,将需要其他JVM支持。 据我了解,JVM上已经有多种语言将协程作为其功能集的一部分,例如Kotlin和Scala。 那么,如何在没有其他支持的情况下实现此功能,而没有其他支持,是否可以有效地实现它呢? 问题答案: tl; dr 摘要: 特别是,该建议说,要以该语言

  • 问题内容: 我需要一个代码示例或库来解析标头并返回我的首选语言。 RFC2616指出: Accept-Language请求标头字段类似于Accept,但是限制了首选自然语言集作为对请求的响应。语言标签在3.10节中定义。 可以给每个语言范围一个相关的质量值,该质量值表示用户对该范围指定的语言的偏好的估计。质量值默认为“ q = 1”。 进一步的阅读显示,太多的“可选”,“应该”,“可能”和其他语音

  • 问题内容: 我正在尝试使用此库运行示例项目,但出现以下错误: 我在 libs* 和 classpath中 添加了 commons-lang-2.6.jar 和 commons- lang3-3.1-sources.jar *** 主班: 我已提及以下链接: java.lang.ClassNotFoundException:来自BaseClassLoader的org.apache.commons.l

  • 问题内容: 当我将Hibernate 5添加到我的网站时,无法在Glassfish 4.1.1中使用它。我总是会出错 java.lang.NoSuchMethodError:org.jboss.logging.Logger.debugf(Ljava / lang / String; I)V 我试图替换Glassfish的modules文件夹中的jboss- logging库,就像我读到一个类似问题

  • 问题内容: 当我比较Apache 与vs的性能时,我惊讶地发现前者的速度大约是后者的4倍。我使用Google的Caliper框架来衡量性能。这是我的测试 输出 这是为什么?两种方法似乎做同样的工作,甚至更加灵活。 问题答案: 从1的源代码中: 与实施,因此,它是不奇怪的是较慢的是2,这是与实现和。 脚注 1我链接到并复制源代码的版本是JDK 7 2我链接到并从中复制源代码的版本是common-la

  • 问题内容: 考虑以下代码: 我有一些要求,例如我想读取/获取所有类型的键和值以进行某些处理,但我无法定义它,因为我将获得动态JSON输入(例如,作为字符串,那么第二级循环将给我索引)数组并处理每个具有key 和的JSON 。 我希望遍历其中包含的每个键/值对,浏览地图的最有效方法是什么? 注意:我是Go-lang的新手,也欢迎您提出问题。 问题答案: 请参阅此博客条目,该条目彻底涵盖了该主题,尤其