有了Lua和Python嵌入式,是否有Basic的地方?

时间:2022-09-11 20:45:24

I started off programming in Basic on the ZX81, then BASICA, GW-BASIC, and QBasic. I moved on to C (Ah, Turbo C 3.1, I hardly knew ye...)

我开始在ZX81上使用Basic编程,然后是BASICA,GW-BASIC和QBasic。我转到C(啊,Turbo C 3.1,我几乎不知道你......)

When I got started in microcontrollers I regressed with the BASIC Stamp from Parallax. However, BASIC is/was awesome because it was so easy to understand and so hard to make a mistake. I moved on to assembly and C eventually because I needed the additional power (speed, capacity, resources, etc.), but I know that if the bar was much higher many people would never get into programming microcontrollers.

当我开始使用微控制器时,我使用了Parallax的BASIC Stamp。然而,BASIC非常棒,因为它很容易理解并且很难犯错误。我最终转向装配和C,因为我需要额外的功率(速度,容量,资源等),但我知道如果条形图高得多,许多人将永远不会进入编程微控制器。

I keep getting an itch to make my own on-chip BASIC interpretor, but I wonder if there's need for BASIC now that Lua and Python are easily embeddable, and just as approachable as BASIC.

我一直在努力制作自己的片上BASIC解释器,但我想知道是否需要BASIC,因为Lua和Python很容易嵌入,并且和BASIC一样平易近人。

  • What, if any, are the advantages BASIC has over other languages?
  • BASIC比其他语言有什么优势?

  • Why is it still around?
  • 它为什么还在?

  • If I decide to make a general purpose microcontroller board with an interpreter, is there any reason to make a version of BASIC?
  • 如果我决定使用解释器制作通用微控制器板,是否有任何理由制作BASIC版本?

Plenty of other languages are considered dead, but BASIC just keeps hanging on.

许多其他语言被认为已经死亡,但BASIC一直坚持不懈。

9 个解决方案

#1


6  

As an architecture, the main claim to fame of BASIC is that you could make BASIC interpreters very small - just a few KB. In the days of a DG Nova this was a win as you could use systems like Business BASIC to build a multiuser application on a machine with 64K of RAM (or even less).

作为一种架构,BASIC声名鹊起的主要原因是你可以使BASIC解释器非常小 - 只需几KB。在DG Nova的时代,这是一个胜利,因为您可以使用Business BASIC等系统在具有64K RAM(甚至更少)的机器上构建多用户应用程序。

BASIC (VB in particular) is a legacy system and has a large existing code-base. Arguably VB is really a language (some would say a thin wrapper over COM) that has a BASIC-like syntax. These days, I see little reason to keep the language around apart from people's familiarity with it and to maintain the existing code base. I certainly would not advocate new development in it (note that VB.Net is not really BASIC but just has a VB-like syntax. The type system is not broken in the way that VB's was.)

BASIC(特别是VB)是遗留系统,具有大量现有代码库。可以说VB实际上是一种语言(有些人会说是COM上的薄包装),它具有类似BASIC的语法。现在,我认为没有什么理由可以保持语言与人们对它的熟悉程度并保持现有的代码库。我当然不会提倡新的开发(请注意,VB.Net并不是真正的BASIC,只是具有类似VB的语法。类型系统没有像VB那样被打破。)

What is missing from the computing world is a relevant language that is easy to learn and tinker with and has mind-share in mainstream application development. I grew up in the days of 8-bit machines, and the entry barrier to programming on those systems was very low. The architecture of the machines was very simple, and you could learn to program and write more-or-less relevant applications on these machines very easily.

计算机世界缺少的是一种易于学习和修补的相关语言,并且在主流应用程序开发中具有思想共享。我在8位机器的时代长大,在这些系统上编程的入门门槛非常低。机器的架构非常简单,您可以学习在这些机器上编程和编写或多或少的相关应用程序。

Modern architectures are much more complex and have a bigger hump to learn. You can see people pontificating on how kids can't learn to program as easily as they could back in the days of BASIC and 8-bit computers and I think that argument has some merit. There is something of a hole left that makes programming just that bit harder to get into. Toy languages are not much use here - for programming to be attractive it has to be possible to aspire to build something relevant with the language you are learning.

现代建筑更加复杂,需要更大的学习空间。你可以看到人们在BASIC和8位计算机时代就像孩子们学习编程一样容易,并且我认为这个论点有一些优点。还有一些漏洞使得编程变得更难以进入。玩具语言在这里用处不大 - 为了使编程具有吸引力,必须有可能建立与您正在学习的语言相关的东西。

This leads to the problem of a language that is easy for kids to learn but still allows them to write relevant programmes (or even games) that they might actually want. It also has to be widely perceived as relevant.

这导致了一种易于孩子学习的语言问题,但仍然允许他们编写他们可能真正想要的相关程序(甚至游戏)。它也必须被广泛认为是相关的。

The closest thing I can think of to this is Python. It's not the only example of a language of that type, but it is the one with the most mind-share - and (IMO) a perception of relevance is necessary to play in this niche. It's also one of the easiest languages to learn that I've experienced (of the 30 or so that I've used over the years).

我能想到的最接近的是Python。它不是这种类型语言的唯一例子,但它是心灵分享最多的一种语言 - 而且(IMO)在这个利基市场中发挥相关性是必要的。它也是我所经历的最容易学习的语言之一(多年来我使用过的30多种语言)。

#2


10  

[This may come off sounding more negative than it really is. I'm not saying Basic is the root of all evil, others have said that. I'm saying it's a legacy we can afford to leave behind.]

[这可能听起来比实际上更负面。我不是说基本是所有邪恶的根源,其他人已经说过了。我说这是我们可以留下的遗产。]

"because it was so easy to understand and so hard to make a mistake" That's certainly debatable. I've had some bad experiences with utterly opaque basic. Professional stuff -- commercial products -- perfectly awful code. Had to give up and decline the work.

“因为它很容易理解而且很难犯错误”这当然值得商榷。我有一些完全不透明的基本经验。专业的东西 - 商业产品 - 非常糟糕的代码。不得不放弃和拒绝工作。

"What, if any, are the advantages Basic has over other languages?" None, really.

“如果有的话,Basic有什么优于其他语言?”没有,真的。

"Why is it still around?" Two reasons: (1) Microsoft, (2) all the IT departments that started doing VB and now have millions of lines of VB legacy code.

“它为什么还在?”有两个原因:(1)微软,(2)所有开始做VB的IT部门现在拥有数百万行VB遗留代码。

"Plenty of other languages are considered dead..." Yep. Basic is there along side COBOL, PL/I and RPG as legacies that sometimes have more cost than value. But because of the "if it ain't broke don't fix it" policy of big IT, there they sit, sucking up resources who could easily replace it with something smaller, simpler and cheaper to maintain. Except it hasn't "failed" -- it's just disproportionately expensive.

“很多其他语言被认为已经死了......”是的。基本与COBOL,PL / I和RPG一起作为遗产,有时成本高于价值。但是由于“如果它没有破坏不解决它”的大IT政策,他们坐在那里,吸收资源,可以轻松地用更小,更简单和更便宜的维护代替它。除了它没有“失败” - 它只是不成比例地昂贵。

30-year old COBOL is a horrible situation to rework. Starting in 2016 we'll be looking at 30-year old MS Basic that we just can't figure out, don't want to live without, and can't decide how to replace.

30岁的COBOL是一个糟糕的返工情况。从2016年开始,我们将会看到30岁的MS Basic,我们无法弄清楚,不想没有生活,也无法决定如何更换。

"but basic just keeps hanging on" It appears that some folks love Basic. Others see it as yet another poorly-designed language; it's advantages are being early to market and being backed by huge vendors (IBM, initially). Poorly-design, early-to-market only leaves us with a legacy that we'll be suffering with for decades.

“但基本只是一直挂着”似乎有些人喜欢Basic。其他人认为这是另一种设计糟糕的语言;它的优点是早期上市并得到大型供应商的支持(IBM,最初)。设计不良,早期上市只会让我们留下几十年来我们将要遭受的遗产。

I still have my 1965-edition Dartmouth Basic manual. I don't long for the good old days.

我还有1965年版的达特茅斯基本手册。我不会渴望过去的美好时光。

#3


2  

Why not give Jumentum a try and see how it works for you?

为什么不试试Jumentum,看看它对你有用吗?

http://jumentum.sourceforge.net/

it's an open source BASIC for micrcontrollers

它是微控制器的开源BASIC

The elua project is also lua for microcontrollers

对于微控制器,该项目也是lua

http://elua.berlios.de/

#4


2  

BASIC persists, particularly in the STAMP implementation, because it is lower level than most other very-easy-to-learn programming languages. For most embedded BASIC implementations the BASIC instructions map directly to single or groups of machine instructions, with very little overhead. The same programs written in "higher level" languages like Lua or Python would run far slower on those same microcontrollers.

BASIC仍然存在,特别是在STAMP实现中,因为它比大多数其他非常容易学习的编程语言更低。对于大多数嵌入式BASIC实现,BASIC指令直接映射到单个或一组机器指令,而且开销很小。用Lua或Python等“更高级”语言编写的相同程序在相同的微控制器上运行速度要慢得多。

PS: BASIC variants like PBASIC have very little in common with, say, Visual BASIC, despite the naming similarity. They have diverged in very different ways.

PS:尽管命名相似,但像PBASIC这样的基本变体与Visual BASIC几乎没有共同之处。他们以不同的方式分歧。

#5


1  

Good question...

Basically (sic!), I have no answer. I would say just that Lua is very easy to learn, probably as easy as Basic (which was one of my first languages as well, I used dialects on lot of 8-bit computers...), but is more powerful (allowing OO or functional styles and even mixing them) and somehow stricter (no goto...).

基本上(原文如此!),我没有答案。我只想说Lua很容易学习,可能和Basic一样简单(这也是我的第一种语言之一,我在很多8位计算机上使用方言......),但更强大(允许OO)或功能样式,甚至混合它们)和某种程度上更严格(没有转到...)。

I don't know well Python, but from what I have read, it is as easy, powerful and strict than Lua.

我不太了解Python,但从我读过的内容来看,它比Lua简单,强大和严格。

Beside, both are "standardized" de facto, ie. there are no dialects (beside the various versions), unlike Basic which has many variants.

此外,两者都是事实上的“标准化”,即。没有方言(在各种版本旁边),不像Basic有很多变种。

Also both have carefully crafted VM, efficient, (mostly) bugless. Should you make your own interpretor, you should either take an existing VM and generate bytecode for it from Basic source, or make your own. Sure fun stuff, but time consuming and prone to bugs...

两者都精心制作VM,高效,(大部分)无bug。如果您自己创建解释器,则应该从现有的虚拟机中获取现有的虚拟机并为其生成字节码,或者创建自己的虚拟机。当然有趣的东西,但耗时且容易出错...

So, I would just let Basic have a nice retirement... :-P

所以,我只想让Basic退休... :-P

PS.: Why it is hanging on? Perhaps Microsoft isn't foreign to that... (VB, VBA, VBScript...)
There are also lot of dialects around (RealBasic, DarkBasic, etc.), with some audience.

PS。:为什么要挂?也许微软并不陌生......(VB,VBA,VBScript ......)还有很多方言(RealBasic,DarkBasic等)和一些观众。

#6


1  

At the risk of sounding like two old-timers on rocking chairs, let me grumpily say that "Kids today don't appreciate BASIC" and then paradoxically say "They don't know how good they've got it."

冒着像摇椅上的两位老人一样的风险,让我脾气暴躁地说“今天的孩子不喜欢BASIC”,然后矛盾地说“他们不知道他们有多好”。

BASICs greatest strength was always its comprehensibility. It was something that people could get. That was long ignored by academics and language developers.

BASIC最大的优势始终是它的可理解性。这是人们可以得到的东西。学者和语言开发人员长期忽略了这一点。

When you talk about wanting to implement BASIC, I assume you're not talking about line-numbered BASIC, but a structured form. The problem with that is that as soon as you start moving into structured programming -- functions, 'why can't I just GOTO that spot?', etc. -- it really becomes unclear what advantages, if any, BASIC would have over, say, Python.

当你谈到想要实现BASIC时,我假设你不是在谈论行编号的BASIC,而是一个结构化的形式。问题在于,一旦你开始进入结构化编程 - 函数,'为什么我不能只是GOTO那个位置?'等等 - 真的变得不清楚BASIC会有什么优势,如果有的话比方说,Python。

Additionally, one reason BASIC was "so easy to get right" was that in those days libraries weren't nearly as important as they are today. Libraries imply structured if not object-oriented programming, so again you're in a situation where a more modern dynamic scripting language "fits" the reality of what people do today better.

此外,BASIC“如此容易做对”的一个原因是,当时图书馆并不像现在这么重要。如果不是面向对象的编程,那么图书馆意味着结构化,所以你再次处于这样一种情况:一种更现代的动态脚本语言“更适合”人们今天做得更好的现实。

If the real question is "well, I want to implement an interpreter and so it comes down to return on investment," then it becomes a problem of an grammar that's actually easy to implement. I'd suggest that BASIC doesn't really have that many advantages in that regard either (unless you really do return to line numbers and a very limited grammar).

如果真正的问题是“好的,我想实现一个解释器,因此归结为投资回报”,那么它就成了一个实际上易于实现的语法问题。我建议BASIC在这方面也没有那么多优点(除非你真的回到行号和非常有限的语法)。

In short, I don't think you should invest your effort in a BASIC interpreter.

简而言之,我认为您不应该将您的精力投入到BASIC解释器中。

#7


1  

Well, these people seem to think that not only basic still has a place in the mobile space but also that they can make money off it:

嗯,这些人似乎认为,不仅基本仍然在移动领域占有一席之地,而且他们可以从中赚钱:

http://www.nsbasic.com/symbian/

#8


1  

I started out on a ZX81 too. But as Tony Hoare said, programming in BASIC is like trying to do long division using roman numerals.

我也开始使用ZX81。但正如Tony Hoare所说,BASIC中的编程就像尝试使用罗马数字进行长时间划分一样。

Plenty of other languages are considered dead, but basic just keeps hanging on.

许多其他语言被认为已经死亡,但基本只是一直在继续。

Sadly yes. I blame Bill Gates for this...BASIC was on a stretcher with a priest saying the last rites for it, and then MS brought it back like Smallpox.

可悲的是。我责怪比尔盖茨这个...... BASIC在担架上,一位牧师说最后的仪式,然后MS把它带回来像天花。

#9


0  

I used to program in BASIC in the QBasic days. QBASIC had subroutines, functions, structures (they used to be called types), and I guess that's it. Now, this seems limited compared to all the features that Python has - OO, lambdas, metaclasses, generators, list comprehensions, just to name a few off the top of my head. But that simplicity, I think, is a strength of BASIC. If you're looking at a simple embeddable language, I'd bet that QBasic will be faster and easier to understand. And a procedural langauge is probably more than sufficient for most embedding/scripting type of applications.

我曾经在QBasic时代在BASIC中编程。 QBASIC有子程序,函数,结构(它们曾经被称为类型),我猜就是这样。现在,与Python具有的所有功能相比,这似乎有限--OO,lambdas,元类,生成器,列表推导,仅举几例。但我认为,这种简单性是BASIC的优势。如果您正在寻找一种简单的可嵌入语言,我敢打赌QBasic会更快更容易理解。对于大多数嵌入/脚本类型的应用程序而言,程序语言可能已经绰绰有余了。

I'd say the most important reason BASIC is still around is Visual Basic. For a long time in the 90s, VB was the only way to write GUIs, COM and DB code for Windows without falling into one of the C++ Turing tarpits. [Maybe Delphi was a good option too, but unfortunately it never became as popular as VB]. I do think it is because of all this VB and VBA code that is still being used and maintained that BASIC still isn't dead.

我想说BASIC仍然存在的最重要原因是Visual Basic。在90年代的很长一段时间里,VB是为Windows编写GUI,COM​​和DB代码而不属于C ++ Turing tarpits的唯一方法。 [也许Delphi也是一个不错的选择,但不幸的是它从来没有像VB那样受欢迎]。我认为这是因为所有这些VB和VBA代码仍在使用和维护,BASIC仍然没有死。

That said, I'd say there's pretty a good rationale to write BASIC interpreter (maybe even compiler using LLVM or something similar) for BASIC today. You'll get a clean, simple easy to use and fast language if you implement something that resembles QBasic. You won't have to solve any language design issues and the best part is people will already know your language.

也就是说,我认为今天为BASIC编写BASIC解释器(甚至可能使用LLVM或类似的编译器)是非常合理的。如果你实现类似QBasic的东西,你将获得一个干净,简单易用和快速的语言。您不必解决任何语言设计问题,最好的部分是人们已经知道您的语言。

#1


6  

As an architecture, the main claim to fame of BASIC is that you could make BASIC interpreters very small - just a few KB. In the days of a DG Nova this was a win as you could use systems like Business BASIC to build a multiuser application on a machine with 64K of RAM (or even less).

作为一种架构,BASIC声名鹊起的主要原因是你可以使BASIC解释器非常小 - 只需几KB。在DG Nova的时代,这是一个胜利,因为您可以使用Business BASIC等系统在具有64K RAM(甚至更少)的机器上构建多用户应用程序。

BASIC (VB in particular) is a legacy system and has a large existing code-base. Arguably VB is really a language (some would say a thin wrapper over COM) that has a BASIC-like syntax. These days, I see little reason to keep the language around apart from people's familiarity with it and to maintain the existing code base. I certainly would not advocate new development in it (note that VB.Net is not really BASIC but just has a VB-like syntax. The type system is not broken in the way that VB's was.)

BASIC(特别是VB)是遗留系统,具有大量现有代码库。可以说VB实际上是一种语言(有些人会说是COM上的薄包装),它具有类似BASIC的语法。现在,我认为没有什么理由可以保持语言与人们对它的熟悉程度并保持现有的代码库。我当然不会提倡新的开发(请注意,VB.Net并不是真正的BASIC,只是具有类似VB的语法。类型系统没有像VB那样被打破。)

What is missing from the computing world is a relevant language that is easy to learn and tinker with and has mind-share in mainstream application development. I grew up in the days of 8-bit machines, and the entry barrier to programming on those systems was very low. The architecture of the machines was very simple, and you could learn to program and write more-or-less relevant applications on these machines very easily.

计算机世界缺少的是一种易于学习和修补的相关语言,并且在主流应用程序开发中具有思想共享。我在8位机器的时代长大,在这些系统上编程的入门门槛非常低。机器的架构非常简单,您可以学习在这些机器上编程和编写或多或少的相关应用程序。

Modern architectures are much more complex and have a bigger hump to learn. You can see people pontificating on how kids can't learn to program as easily as they could back in the days of BASIC and 8-bit computers and I think that argument has some merit. There is something of a hole left that makes programming just that bit harder to get into. Toy languages are not much use here - for programming to be attractive it has to be possible to aspire to build something relevant with the language you are learning.

现代建筑更加复杂,需要更大的学习空间。你可以看到人们在BASIC和8位计算机时代就像孩子们学习编程一样容易,并且我认为这个论点有一些优点。还有一些漏洞使得编程变得更难以进入。玩具语言在这里用处不大 - 为了使编程具有吸引力,必须有可能建立与您正在学习的语言相关的东西。

This leads to the problem of a language that is easy for kids to learn but still allows them to write relevant programmes (or even games) that they might actually want. It also has to be widely perceived as relevant.

这导致了一种易于孩子学习的语言问题,但仍然允许他们编写他们可能真正想要的相关程序(甚至游戏)。它也必须被广泛认为是相关的。

The closest thing I can think of to this is Python. It's not the only example of a language of that type, but it is the one with the most mind-share - and (IMO) a perception of relevance is necessary to play in this niche. It's also one of the easiest languages to learn that I've experienced (of the 30 or so that I've used over the years).

我能想到的最接近的是Python。它不是这种类型语言的唯一例子,但它是心灵分享最多的一种语言 - 而且(IMO)在这个利基市场中发挥相关性是必要的。它也是我所经历的最容易学习的语言之一(多年来我使用过的30多种语言)。

#2


10  

[This may come off sounding more negative than it really is. I'm not saying Basic is the root of all evil, others have said that. I'm saying it's a legacy we can afford to leave behind.]

[这可能听起来比实际上更负面。我不是说基本是所有邪恶的根源,其他人已经说过了。我说这是我们可以留下的遗产。]

"because it was so easy to understand and so hard to make a mistake" That's certainly debatable. I've had some bad experiences with utterly opaque basic. Professional stuff -- commercial products -- perfectly awful code. Had to give up and decline the work.

“因为它很容易理解而且很难犯错误”这当然值得商榷。我有一些完全不透明的基本经验。专业的东西 - 商业产品 - 非常糟糕的代码。不得不放弃和拒绝工作。

"What, if any, are the advantages Basic has over other languages?" None, really.

“如果有的话,Basic有什么优于其他语言?”没有,真的。

"Why is it still around?" Two reasons: (1) Microsoft, (2) all the IT departments that started doing VB and now have millions of lines of VB legacy code.

“它为什么还在?”有两个原因:(1)微软,(2)所有开始做VB的IT部门现在拥有数百万行VB遗留代码。

"Plenty of other languages are considered dead..." Yep. Basic is there along side COBOL, PL/I and RPG as legacies that sometimes have more cost than value. But because of the "if it ain't broke don't fix it" policy of big IT, there they sit, sucking up resources who could easily replace it with something smaller, simpler and cheaper to maintain. Except it hasn't "failed" -- it's just disproportionately expensive.

“很多其他语言被认为已经死了......”是的。基本与COBOL,PL / I和RPG一起作为遗产,有时成本高于价值。但是由于“如果它没有破坏不解决它”的大IT政策,他们坐在那里,吸收资源,可以轻松地用更小,更简单和更便宜的维护代替它。除了它没有“失败” - 它只是不成比例地昂贵。

30-year old COBOL is a horrible situation to rework. Starting in 2016 we'll be looking at 30-year old MS Basic that we just can't figure out, don't want to live without, and can't decide how to replace.

30岁的COBOL是一个糟糕的返工情况。从2016年开始,我们将会看到30岁的MS Basic,我们无法弄清楚,不想没有生活,也无法决定如何更换。

"but basic just keeps hanging on" It appears that some folks love Basic. Others see it as yet another poorly-designed language; it's advantages are being early to market and being backed by huge vendors (IBM, initially). Poorly-design, early-to-market only leaves us with a legacy that we'll be suffering with for decades.

“但基本只是一直挂着”似乎有些人喜欢Basic。其他人认为这是另一种设计糟糕的语言;它的优点是早期上市并得到大型供应商的支持(IBM,最初)。设计不良,早期上市只会让我们留下几十年来我们将要遭受的遗产。

I still have my 1965-edition Dartmouth Basic manual. I don't long for the good old days.

我还有1965年版的达特茅斯基本手册。我不会渴望过去的美好时光。

#3


2  

Why not give Jumentum a try and see how it works for you?

为什么不试试Jumentum,看看它对你有用吗?

http://jumentum.sourceforge.net/

it's an open source BASIC for micrcontrollers

它是微控制器的开源BASIC

The elua project is also lua for microcontrollers

对于微控制器,该项目也是lua

http://elua.berlios.de/

#4


2  

BASIC persists, particularly in the STAMP implementation, because it is lower level than most other very-easy-to-learn programming languages. For most embedded BASIC implementations the BASIC instructions map directly to single or groups of machine instructions, with very little overhead. The same programs written in "higher level" languages like Lua or Python would run far slower on those same microcontrollers.

BASIC仍然存在,特别是在STAMP实现中,因为它比大多数其他非常容易学习的编程语言更低。对于大多数嵌入式BASIC实现,BASIC指令直接映射到单个或一组机器指令,而且开销很小。用Lua或Python等“更高级”语言编写的相同程序在相同的微控制器上运行速度要慢得多。

PS: BASIC variants like PBASIC have very little in common with, say, Visual BASIC, despite the naming similarity. They have diverged in very different ways.

PS:尽管命名相似,但像PBASIC这样的基本变体与Visual BASIC几乎没有共同之处。他们以不同的方式分歧。

#5


1  

Good question...

Basically (sic!), I have no answer. I would say just that Lua is very easy to learn, probably as easy as Basic (which was one of my first languages as well, I used dialects on lot of 8-bit computers...), but is more powerful (allowing OO or functional styles and even mixing them) and somehow stricter (no goto...).

基本上(原文如此!),我没有答案。我只想说Lua很容易学习,可能和Basic一样简单(这也是我的第一种语言之一,我在很多8位计算机上使用方言......),但更强大(允许OO)或功能样式,甚至混合它们)和某种程度上更严格(没有转到...)。

I don't know well Python, but from what I have read, it is as easy, powerful and strict than Lua.

我不太了解Python,但从我读过的内容来看,它比Lua简单,强大和严格。

Beside, both are "standardized" de facto, ie. there are no dialects (beside the various versions), unlike Basic which has many variants.

此外,两者都是事实上的“标准化”,即。没有方言(在各种版本旁边),不像Basic有很多变种。

Also both have carefully crafted VM, efficient, (mostly) bugless. Should you make your own interpretor, you should either take an existing VM and generate bytecode for it from Basic source, or make your own. Sure fun stuff, but time consuming and prone to bugs...

两者都精心制作VM,高效,(大部分)无bug。如果您自己创建解释器,则应该从现有的虚拟机中获取现有的虚拟机并为其生成字节码,或者创建自己的虚拟机。当然有趣的东西,但耗时且容易出错...

So, I would just let Basic have a nice retirement... :-P

所以,我只想让Basic退休... :-P

PS.: Why it is hanging on? Perhaps Microsoft isn't foreign to that... (VB, VBA, VBScript...)
There are also lot of dialects around (RealBasic, DarkBasic, etc.), with some audience.

PS。:为什么要挂?也许微软并不陌生......(VB,VBA,VBScript ......)还有很多方言(RealBasic,DarkBasic等)和一些观众。

#6


1  

At the risk of sounding like two old-timers on rocking chairs, let me grumpily say that "Kids today don't appreciate BASIC" and then paradoxically say "They don't know how good they've got it."

冒着像摇椅上的两位老人一样的风险,让我脾气暴躁地说“今天的孩子不喜欢BASIC”,然后矛盾地说“他们不知道他们有多好”。

BASICs greatest strength was always its comprehensibility. It was something that people could get. That was long ignored by academics and language developers.

BASIC最大的优势始终是它的可理解性。这是人们可以得到的东西。学者和语言开发人员长期忽略了这一点。

When you talk about wanting to implement BASIC, I assume you're not talking about line-numbered BASIC, but a structured form. The problem with that is that as soon as you start moving into structured programming -- functions, 'why can't I just GOTO that spot?', etc. -- it really becomes unclear what advantages, if any, BASIC would have over, say, Python.

当你谈到想要实现BASIC时,我假设你不是在谈论行编号的BASIC,而是一个结构化的形式。问题在于,一旦你开始进入结构化编程 - 函数,'为什么我不能只是GOTO那个位置?'等等 - 真的变得不清楚BASIC会有什么优势,如果有的话比方说,Python。

Additionally, one reason BASIC was "so easy to get right" was that in those days libraries weren't nearly as important as they are today. Libraries imply structured if not object-oriented programming, so again you're in a situation where a more modern dynamic scripting language "fits" the reality of what people do today better.

此外,BASIC“如此容易做对”的一个原因是,当时图书馆并不像现在这么重要。如果不是面向对象的编程,那么图书馆意味着结构化,所以你再次处于这样一种情况:一种更现代的动态脚本语言“更适合”人们今天做得更好的现实。

If the real question is "well, I want to implement an interpreter and so it comes down to return on investment," then it becomes a problem of an grammar that's actually easy to implement. I'd suggest that BASIC doesn't really have that many advantages in that regard either (unless you really do return to line numbers and a very limited grammar).

如果真正的问题是“好的,我想实现一个解释器,因此归结为投资回报”,那么它就成了一个实际上易于实现的语法问题。我建议BASIC在这方面也没有那么多优点(除非你真的回到行号和非常有限的语法)。

In short, I don't think you should invest your effort in a BASIC interpreter.

简而言之,我认为您不应该将您的精力投入到BASIC解释器中。

#7


1  

Well, these people seem to think that not only basic still has a place in the mobile space but also that they can make money off it:

嗯,这些人似乎认为,不仅基本仍然在移动领域占有一席之地,而且他们可以从中赚钱:

http://www.nsbasic.com/symbian/

#8


1  

I started out on a ZX81 too. But as Tony Hoare said, programming in BASIC is like trying to do long division using roman numerals.

我也开始使用ZX81。但正如Tony Hoare所说,BASIC中的编程就像尝试使用罗马数字进行长时间划分一样。

Plenty of other languages are considered dead, but basic just keeps hanging on.

许多其他语言被认为已经死亡,但基本只是一直在继续。

Sadly yes. I blame Bill Gates for this...BASIC was on a stretcher with a priest saying the last rites for it, and then MS brought it back like Smallpox.

可悲的是。我责怪比尔盖茨这个...... BASIC在担架上,一位牧师说最后的仪式,然后MS把它带回来像天花。

#9


0  

I used to program in BASIC in the QBasic days. QBASIC had subroutines, functions, structures (they used to be called types), and I guess that's it. Now, this seems limited compared to all the features that Python has - OO, lambdas, metaclasses, generators, list comprehensions, just to name a few off the top of my head. But that simplicity, I think, is a strength of BASIC. If you're looking at a simple embeddable language, I'd bet that QBasic will be faster and easier to understand. And a procedural langauge is probably more than sufficient for most embedding/scripting type of applications.

我曾经在QBasic时代在BASIC中编程。 QBASIC有子程序,函数,结构(它们曾经被称为类型),我猜就是这样。现在,与Python具有的所有功能相比,这似乎有限--OO,lambdas,元类,生成器,列表推导,仅举几例。但我认为,这种简单性是BASIC的优势。如果您正在寻找一种简单的可嵌入语言,我敢打赌QBasic会更快更容易理解。对于大多数嵌入/脚本类型的应用程序而言,程序语言可能已经绰绰有余了。

I'd say the most important reason BASIC is still around is Visual Basic. For a long time in the 90s, VB was the only way to write GUIs, COM and DB code for Windows without falling into one of the C++ Turing tarpits. [Maybe Delphi was a good option too, but unfortunately it never became as popular as VB]. I do think it is because of all this VB and VBA code that is still being used and maintained that BASIC still isn't dead.

我想说BASIC仍然存在的最重要原因是Visual Basic。在90年代的很长一段时间里,VB是为Windows编写GUI,COM​​和DB代码而不属于C ++ Turing tarpits的唯一方法。 [也许Delphi也是一个不错的选择,但不幸的是它从来没有像VB那样受欢迎]。我认为这是因为所有这些VB和VBA代码仍在使用和维护,BASIC仍然没有死。

That said, I'd say there's pretty a good rationale to write BASIC interpreter (maybe even compiler using LLVM or something similar) for BASIC today. You'll get a clean, simple easy to use and fast language if you implement something that resembles QBasic. You won't have to solve any language design issues and the best part is people will already know your language.

也就是说,我认为今天为BASIC编写BASIC解释器(甚至可能使用LLVM或类似的编译器)是非常合理的。如果你实现类似QBasic的东西,你将获得一个干净,简单易用和快速的语言。您不必解决任何语言设计问题,最好的部分是人们已经知道您的语言。