人们今天使用的可扩展语言是什么?

发布于 2024-08-15 10:22:23 字数 264 浏览 10 评论 0原文

维基百科说:

可扩展编程是计算机科学中使用的一个术语,用于描述一种计算机编程风格,重点关注扩展编程语言、编译器和运行时环境的机制。

例如,Tcl 允许您编写自己的控制结构。请参阅此处

我有兴趣编译实际代码中使用的可扩展编程语言的列表。如果您也能为您的语言提供一个示例,那就太好了。

Wikipedia says:

Extensible programming is a term used in computer science to describe a style of computer programming that focuses on mechanisms to extend the programming language, compiler and runtime environment.

For example, Tcl lets you write your own control structures. See here.

I'm interested in compiling a list of extensible programming languages that are being used in real-world code. It would be nice if you could supply an example for your language as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

生生不灭 2024-08-22 10:22:23

LISP 家族中的语言(Common Lisp、Guile 等)极其可扩展 - 比我使用过的任何其他语言都更可扩展。可以将其视为类固醇的 C 宏系统。如果您足够无聊,您可以将 + 运算符重新定义为减法:现在这就是可扩展性!

LISP 在很多地方已经过时了,但是 Guile (Scheme 的一种方言) ) 是 GNU 项目 的官方扩展语言。

Languages in the LISP family (Common Lisp, Guile, et cetera), are extremely extensible--more so than any other language I have ever used. Think of it like the C macro system on steroids. If you were bored enough, you could redefine the + operator as subtraction: now that is extensibility!

LISP has fallen out of fashion in many places, but Guile (a dialect of Scheme) is the official extension language of the GNU Project.

我不会写诗 2024-08-22 10:22:23

严格来说,Ruby 并不是一种可扩展语言,但它的语法足够灵活且强大,如果您仔细观察,它看起来就像是......对于许多用途来说,这已经足够好了。

无论如何,人们实际上使用 Ruby :-)

Ruby is not strictly an extensible language, but the syntax is flexible and powerful enough that if you squint, it kind of looks like it is... which for many purposes is plenty good enough.

At any rate, people actually use Ruby :-)

野の 2024-08-22 10:22:23

Jeebox 是一种可扩展语言,可以描述任何东西,包括代码。

现在,它纯粹用于描述事物......

但是一种可扩展的编程语言,可以非常轻松地构建在 Jeebox 之上。

(我正在 Jeebox 上构建一种普通的、不可扩展的编程语言,仅仅是因为将可扩展性构建到编程语言中不仅仅是一种语言功能。它需要一种递归,您可以在其中编写可以创建更多代码的代码。正确地做到这一点需要比我更多的时间,但很高兴知道我正在使用的语言 Jeebox 可以支持这一点,一旦我有时间这样做。)

Jeebox is an extensible language that can describe anything, including code.

It is used purely to describe things, right now...

But an extensible programming language, could be built ontop of Jeebox, very easily.

(I'm building a normal, non-extensible programming language ontop of Jeebox, simply because building extensibility into a programming language is more than just a language feature. It needs a kind of recursion, where you write code that can create more code. And doing this properly would require more time than I have available. But it's nice to know that the language I'm using, Jeebox, can support this, once I have time to do it.)

糖粟与秋泊 2024-08-22 10:22:23

Scala 也不是严格可扩展的,但您可以定义类似于运算符的内容。例如,在定义 Map 时,您可以使用:

val romanNumeral = Map(
    1 -> "I", 2 -> "II", 3 -> "III"
)

->实际上是在对象 1 上调用的方法,但看起来像一个运算符。

Scala is not strictly extensible either, but you can define what look like operators. For instance when defining a Map, you can use:

val romanNumeral = Map(
    1 -> "I", 2 -> "II", 3 -> "III"
)

The -> is actually a method called on the object 1, but looks like an operator.

太阳男子 2024-08-22 10:22:23

Jetbrains MPS(元编程系统) 提供基于投影编辑器的可扩展语言工作台。它可以帮助您为语言扩展创建编辑器、类型系统、约束、重构和代码生成器。它附带了一些 Java 语言实现和扩展。

mbeddr 是利用该技术的 C 实现。它具有组件系统、发送/接收+客户端/服务器接口、依赖项注入、状态机、测试和 PLE 扩展。它还包含一个可扩展的调试系统,因此您可以将扩展映射到 gdb 并提供舒适的调试体验。几乎所有 C 语言功能都被映射,因此代码生成主要可以通过简化为 C 结构而不是愚蠢的 M2T 转换来处理。

Aynth 是一个使用 mbeddr 编写的简单单音合成器,用于演示组件和发送/接收接口。

无论如何,如果您使用它,您会注意到的第一件事是,在许多情况下,投影编辑并不像文本编辑那么舒服。我们非常习惯基于文本的编辑。但可扩展语言有很多好处。

Jetbrains MPS (Meta-programming System) offers a projectional editor based extendible language workbench. It helps you in creating editors, type-systems, constraints, refactorings and code generators for your language extensions. It ships with some Java language implementation and extensions.

mbeddr is a C implementation utilizing this technology. It has component system, send/receive + client/server interfaces, dependency injection, state machines, testing and PLE extensions. It also contains an extensible debugging system so you can map your extensions to gdb and provide a comfortable debugging experience. Almost entire C language features are mapped so code generation can be mostly handled by reduction to C constructs instead of dumb M2T transformations.

Aynth is a simple monophonic synth written using mbeddr for the demonstration of components and send/receive interfaces.

Anyway, the first thing you'll notice if you use it will be, projectional editing isn't as comfortable as text editing in many cases. We're so much used to text based editing. But extensible languages have plenty benefits.

你穿错了嫁妆 2024-08-22 10:22:23

关于可扩展编程的维基百科文章提到了该语言Seed7。 Seed7 的维基百科文章将其描述为:

除了许多其他功能之外,它还提供了扩展机制。 Seed7 支持将新语法及其语义引入到语言中,并且允许使用 Seed7 语言本身定义新的语言结构。例如:程序员可以引入新语句的语法和语义以及用户定义的运算符符号。

Seed7 被设计为从头开始的可扩展语言。整个语言并不是在编译器中硬编码的。相反,Seed7 是在库中定义的,这些库在编译程序时加载。恕我直言,Seed7 是唯一一种将可扩展性作为基本特征并且其他一切都基于它的语言。其他方法使用传统语言,其中编译器使用硬编码语法和语义分析,并在其上附加一些扩展机制。

The Wikipedia article about Extensible programming mentions the language Seed7. The Wikipedia article of Seed7 describes it as:

In addition to many other features it provides an extension mechanism. Seed7 supports the introduction of new syntax and their semantics into the language and it allows new language constructs to be defined using the Seed7 language itself. E.g.: Programmers can introduce syntax and semantic of new statements as well as user defined operator symbols.

Seed7 is designed as extensible language from ground up. The whole language is not hard-coded in the compiler. Instead Seed7 is defined in libraries, which are loaded when the program is compiled. IMHO Seed7 is the only language where extensibility is a basic feature and everything else is based on it. Other approaches use a conventional language, where the compiler uses hard-coded syntax and semantic analysis, and bolt some extension mechanism on it.

对你而言 2024-08-22 10:22:23

TCL 语言是一种动态语言,几乎没有基本规则< /a>:

Tcl的精神是“一切都是字符串”、“一切都是命令”< /a>,甚至控制流结构。

例如,let 用自定义循环替换 while 循环。

# rename original while to orig_while for future usage.
rename while orig_while; 

#redefine while
proc while {cond body} {
# add customization code

# calculate while call count.
global while_call_count;
incr while_call_count;

# call original while in uper level stack 
 uplevel orig_while $cond $body;

# add customization code
}

Tcl有C语言接口,它允许非常容易地将Tcl集成到现有程序中。
Tcl 在EDA 工具中使用非常广泛。

最后,TCL 如此强大,以至于无法定义 Tcl BNF,这带来了很多麻烦

The TCL language is a dynamic language with few fundamental rules:

The spirit of Tcl is "Everything is a string", "everything is a command", even control flow constructions.

For instance let to replace while loop with custom one.

# rename original while to orig_while for future usage.
rename while orig_while; 

#redefine while
proc while {cond body} {
# add customization code

# calculate while call count.
global while_call_count;
incr while_call_count;

# call original while in uper level stack 
 uplevel orig_while $cond $body;

# add customization code
}

Tcl has C language interface which allow to integrate Tcl into exists program very easily.
Tcl used in EDA tools very extensively.

And finally TCL so powerful that it is not possible to define Tcl BNF, which brings lot of headaches.

狼性发作 2024-08-22 10:22:23

第四,APL、ADA、LisP、COMAL、Oberon 和 Eiffel 都是可扩展语言。可以创建基本编译器/运行时指令并将其添加到范例中。

Forth, APL, ADA, LisP, COMAL, Oberon, and Eiffel, are extensible languages. Base compiler/runtime instructions may be created and added to the paradigm.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文