Hacker News new | past | comments | ask | show | jobs | submit login
Why am I wasting time on EndBASIC? (jmmv.dev)
57 points by todsacerdoti on Jan 24, 2021 | hide | past | favorite | 45 comments



LOL.

I, too, recently implemented BASIC. It was something to do while bored. I was motivated by a desire to play the old star trek game, which it now does. It's called TrekBasic, but the github project it still private, as it's just a fun hack.

It is not as cool as yours, as I wrote it in python. It does have better features for developers than most BASICs from long ago:

    Code breakpoints
    Data write breakpoints
    Single stepping
    Execution timing
    Execution tracing
    Code coverage reports
    Reformatting
    Renumbering

I think my next step will be to move it to LLVM, just for the fun of learning about LLVM.


Ok, I just made the repository public, in case anyone is curious: https://github.com/cocode/TrekBASIC


Nice, I remember vividly being 11 years old and typing this line by line into a Commodore 64, carefully reading it from a ragged copy of “101 BASIC Computer Games”. Took me three days to get it right. I slept next to the computer so my dad wouldn’t turn it off by mistake.

Later ended up porting it to Pascal and adding graphics, in an attempt to learn the language.


I still write almost all my code in Pascal

Why am I wasting time on Pascal?


There are modern iOS games written in Delphi last time I looked around.

I've been spending a little time with ActiveOberon, which might look familiar to a Pascal user. It's an interesting language and environment. Reminds me of Smalltalk the way the platform works (or Pharo for a modern Smalltalk environment), except you absolutely can create more "native" binaries for your environment with it.

ActiveOberon might be one of the first places async/.await style concurrency was implemented. It definitely predates Rust by a bit.

The Fox compiler is an interesting beast too! They're still working on the language. The tip of their SVN tree has enhancements over the language report that was published in 2019 http://cas.inf.ethz.ch/news/2

Now there's ternary conditionals, functors (per C++, not Category Theory) etc.

Last update to the repo was 11 days ago. It's very much alive it seems :-)


If Pascal does the job, why not?


Pascal was my first language, and I really miss some things about it that didn’t make it into the popular modern languages


I wrote a simple BASIC too, for nothing more than a sense of nostalgia:

https://github.com/skx/gobasic


Old Basics had quite impressive debugging features. It had breakpoints (STOP), you were able to inspect and change the content of the variables, change code before or after the breakpoint - and even on the same line - and then CONTINUE from the interruption point. Even ZX80 with 4 KiB of ROM (Basic + OS routines + 0.5 KiB character table) was able to do that (except modification of the same line because it had one command per line only)


They indeed are. As I keep referring to the Locomotive BASIC manual and the QuickBASIC builtin help to implement my version, I'm amazed at how many features those had. Especially the latter was a great IDE even when compared to today's standards.


Locomotive was a great dialect. Fully featured and consistent with few of the arcane incantations that other 8-bit BASICs had.


I would like to use LLVM, to target basic (perhaps VBA or VBScript). Or the JSON used by Power Automate.

But it's probably beyond my capabilities.


This article on running Wasm on the Roku is exactly what you need.

https://motley-coder.com/2020/12/20/webassembly-on-roku/


Thank you! That looks very similar to what I have been idly dreaming of.


You’d probably spend more time learning LLVM than what it might take you to reinvent your own parsing method. (For relatively simple cases I usually recommend flex and bison, they are simple tools that can do wonders.)


Sorry I wasn't clear. Making a backend module for LLVM would presumably allow me to translate a lot of languages into VBA or Power Automate, or maybe Power Query M which is something I'd like to do because I am not a SWE and my machine is locked down at work, and it's more interesting/amusing to work around that than to get myself into a developer position.

I don't want to write a parser. Although I'm aware of bison etc. I just want to get the intermediate representation into a language I can run, so as to leverage the front end compilers.


Hello everyone! Original post/project author here.

I'm honestly surprised to see this bubbling up to the front page after it was originally shared five days ago and failed to gain traction then. But anyway, thanks everyone for stopping by. It was a good surprise.

Coincidentally, I have just pushed a new 0.5 release and a follow-up blog post that might clarify some of the questions I've heard so far: https://jmmv.dev/2021/01/endbasic-0.5.html (although briefly; I'll elaborate more on answers in future posts).

And, well, feel free to AMA!


Cool stuff, man!

I also love to dabble in old, long-dead technologies and feel no need to justify it to anybody. I tinker with old 8 and 16 bit Commodore machines writing code and building hardware and it gives me such a thrill because "young me" would have killed to do this stuff.


On the page, he comments roughly "Basic isn't the language of the future" and makes a joke about the wide usage of Visual Basic.

We shouldn't cast shade on any language like that ( except JavaScript, which deserves all the shade).

The right programming language is the one that lets you express yourself clearly and accurately, and solves your problem with a reasonable tradeoff between implementation overhead and execution costs. That's going to vary based on the problem space and the developer's background. Should he spend 40 hours learning the latest meme language and cobbling together an amateur-night solution rather than 20 minutes actually making something that works with tools that fit the job properly?

Yeah, if the only BASIC you ever used was the pack-in one on the Commodore 64, you're probably fighting the language as much as you are solving the problem. But a modern BASIC, with a rich library, can be a perfectly valid tool choice. In some ways, a traditional and restrictive syntax can be a boon: you're strongly nudged to work within the limitations rather than wandering down trendy architectural rabbit holes.


> The right programming language is the one that lets you express yourself clearly and accurately, and solves your problem with a reasonable tradeoff between implementation overhead and execution costs.

Yeah but thats not the reason why BASIC is around is it? Its around simply as legacy or because MS insists on including it with Excel which makes it a path of least resistance choice. Lets not get too high and mighty about BASIC or VB.NET like stuff. They are bad tools, so are most other tools we use. We just make it work not because its possible, but because nobody wants to go through the requisition forms.

Edit: This comment is brought to you by my painful existence with MATLAB


It's not just for legacy purposes. I've written a few useful personal tools in Purebasic, for instance. BASIC dialects tend to provide the functionality needed and can be handy for quickly throwing something together when you don't have the time to deal with GUI frameworks and complex libraries. You can also use Python or Go, of course, but they do not have integrated IDE and do not have a rich command set in the core language. Easy deployment and compact executables are also a plus of some existing BASIC dialects. If I had the money / the investment in a license would give me a good ROI, then I'd also pay for Xojo, for example.

Whatever gets the job done without wasting time.


> Whatever gets the job done without wasting time.

Completely agreed. My point isn't that these tools can get the job done, but that I see too many people praising them because they can get the job done. There is a difference between done and useful. I can throw together a market model in excel quite fast and easily, its "done". It might even be useful in your case, but please don't give high praise to it because no real world task has ever ended with that task. Everything you will create, especially software will be reused. That's the whole point and power of software. These tools make it incredibly hard to reuse anything. I think we should have higher standards for our tools, especially when whole companies are being built on it (don't think google here, think portfolio management companies and Excel).

Edit: I would like to include an example of a spoon. I can bash in a small nail using it, it will not be good, but it will be done. It will stick one piece of wood to another. but would you praise the spoon as a hammer replacement?


In a life sciences research center I worked with, the work was definitely not done after those scientists got their csv processed files out of the cell reader own data format, generated using their home made VB.NET tool.

It didn't matter, those files were done used as input data into Tableau for further processing, where they could carry on doing the work that actually mattered to them.


I never said you cannot do stuff using VB.NET. Why is this so hard to understand? My point is was VB.NET the best way to do it? Should we praise the tool as good? How do you know that this excel thing, which does not support testing, does not provide feedback when stuff goes wrong will not blow up in your face like that COVID excel[1] from UK did? Please go back and re read my example about the spoon.

[1] https://www.bbc.com/news/technology-54423988


Yes it was, those people were comfortable with VBA, asked IT for VB.NET and were able to quickly proceed with the work that actually mattered to them.

This is the daily reality of industries whose software isn't the main service, not doing beautiful software to reach HN first page.


I think you are misinterpreting my point. I am not saying it cannot be done. I am saying it has higher risk and we should not normalize it just because it gets stuff done. I would like you to actually address the point about the public issues posed by these setups like I pointed out in the COVID case.

Also, you said

> asked IT for VB.NET and were able to quickly proceed with the work that actually mattered to them

I have already addressed this. > We just make it work not because its possible, but because nobody wants to go through the requisition forms.

Edit: Also just insisting that whatever makes it work should be used sounds like a carpenter who is proud of using a spoon as a hammer. Even if you are not a carpenter, I don't think anyone would feel good about using spoon as a hammer in a DIY project.


This is akin to the "Forever Project" concept described by Scott Turner of Here Dragons Abound: https://heredragonsabound.blogspot.com/2020/02/the-forever-p...


ooh, this hits at some things I’ve been seriously struggling with. thank you for the link


This statement is little naive: "If I wanted to change the language per se to offer a more “modern” experience with things like first-order functions, objects, etc. it’d be trivial to do so."

Of course simple simulation of these features could be easily added, but many of more complex modern language features have to be designed from ground up. But I guess it will be the next learning experience for the author and he can have a lot of fun with it as well.


The point of that comment wasn't to say that implementing all language features is trivial, nor to say that designing a language from the ground up is easy.

But rather, than the "shape" of the language I currently implemented is irrelevant. Conditionals and loops are conditionals and loops everywhere. Adding new features isn't easy, but changing how the existing ones look like is. In other words: if you came to this project and left just because BASIC was in the name... well, that's the least interesting part of the whole thing.


I tried the online version and it's really neat. I really like the idea of having a commandline but also an editor you can easily switch to. I have only seen this implemented once before (the BASIC that is shipped with RiscOS).

I understand the author is not working on this for fame, but BASIC is really underrated as a learning language these days. This could be a pretty good playground for teaching kids programming.

I'm going to be so selfish as to give two suggestions/requests. The first is to have a way to switch to a white background in the editor (I managed to do it in the commandline), since it's hard to use for someone with astigmatism like myself.

The other is some graphics features. They may exist but I didn't find any. Something that I really enjoyed as a kid, learning to program, was to use commands such as LINE, CIRCLE, RECTANGLE etc to draw things on the screen. Being a Commodore 64 user, I didn't hey much opportunity to do that until I got a BASIC extension that supported graphics.


Thanks for trying it out and for your suggestions.

As for the white background, thanks for the information on how it plays out with astigmatism; had no idea! I'm still thinking how to add how some form of configuration so that those customizations can stick. (The new release I published today has support for an AUTOEXEC.BAS, so probably that combined with some global environment variables could do the trick.)

As for graphics, definitely. I want to add the features you mention as well as PLAY for music... but that will require some reworking on how the web UI works and I'm not sure how I'd add those to the CLI. But these are definitely in my mind.


Thanks for taking the time to reply. As for the colourscheme, perhaps just a simple toggle button on the web UI to allow for easy switching between light/dark?

I'll be checking out the native version as well, and looking forward to graphics (if for no other reason than to revive some exploratory progarmming in BASIC that I was doing in my childhood :-) ).


Adding buttons to the UI is an alternative indeed, but so far I've resisted to add anything outside of the terminal. Once I let the environment "spill" outside of the terminal emulator, it'll be hard to draw the line on where to stop... and it'll be hard to reconcile that functionality with the command line version. (For example, right now, the editor on the web shows a status bar within the terminal, not outside.)

By the way: replying back to your original post because I did not see that earlier. The idea to have a command line vs. an editor you can easily switch to came from Borland Sidekick Plus. I used to use that back in the day on an 8086 to write Clipper code, and toggling between DOS and the resident editor was very cool.


I see. I knew about those tools at the time, but didn't have much exposure to them as I was a Commodore 64 user, and then moved on to the ST.

I did read a lot about those TSR tools on DOS though. I didn't realise they had full editors.


I’ve recently unearthed a copy of WORM.BAS that is written to run on ZBasic for the Zenith Z100 - it’s the version of “snake” I played as a child. I wish I had an interpreter that could run it, but it relies on the Z100’s direct access to the RAM that holds the text mode font, in order to overwrite the letter shapes with bitmaps of sections of the worm/snake. I have, more than once, tried to port it to a modern context, but the old coding style (no explicit subroutines, just GOSUBs) is very hard to read and even though it is not a lot of lines of code, it is a very painstaking process. I don’t know if hacking a BASIC interpreter would help, but it might!


This post mirrors my feeling on this topic as well. Just like the author, I'm also working on a programming language which will not be used by a lot of people.

In fact, having a lot of users would make things complicated as I would have to stop making incompatible changes if I want to try something new.

Designing your own programming language is such a nice hobby, and something I believe a lot of programmers do. In fact, I would like to see links to other people's programming languages, just to see what people are playing around with at the moment.

Here is my project: https://github.com/lokedhs/array


I recently learnt that 80's high school math text book in U.S. had BASIC program for graphing calculator[1], I felt that's a great way to teach programming.

Not sure whether its being continued in some form, but I feel a python code to compute problems in math and other science subjects needs to be part of curriculum everywhere.

[1] https://twitter.com/heavyinfo/status/1352888793070620672


Please make it work on microcontrollers. And write a book aimed at children to go with it.


That'd be nice indeed. As part of the 0.5 release I have just published, I split the language core from the standard library to ensure the former remains as small as possible. So far, it's at 2,500 lines of non-test code and about 480kb compiled. Not the tiniest, but not too huge! (I know, possibly still huge for microcontrollers, but I'm not too familiar with that domain.)

As for a book... yeah, that'd be nice too. I attempted to write some worksheets earlier with screen-related concepts (rows/columns, cursor positioning) but, well, uncovered enough bugs at the time that I had to put those in the back burner ;) I'll keep thinking about this though, as a few individuals have also asked for something similar.


I think MicroPython already claimed that place.


Or Snek.


Do not underestimate the power of passion and hobby projects. I messed around with RISC-V assembly for my own pleasure last year and ended up landing a short contract on it later.


While this one was done in Rust, I keep thinking someone will eventually come around with a QuickBasic to WASM compiler, written in QB64. :)


BECAUSE is a great reason to do it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: