Jump to content
  • 2
LinuxVSX16

Writing A Compiled Language For the X16

Question

I want to write a programming language for the X16 called Base Camp. I want to write a language because although BASIC is an awesome language the one issue I have with it is that its interpreted so I want Base Camp to be similar to BASIC but with components of modern languages(for example functions) I also would like it to be compiled. Before I can start I have a few questions:

1. Is it practical(should I create Base Camp or is it a bad idea)?

2. Is it possible(is it possible to write Base Camp)?

3. Are there any text editors for the X16 and if not how could I write one?

4. Should I write Base Camp in BASIC or assembly(I'm pretty sure ill write in it assembly but I want to hear other peoples opinions.) 

My skills: I have worked with x86 assembly and am learning 6502 assembly.

Any comments would  be appreciated. Thank You!

  • Like 3

Share this post


Link to post
Share on other sites

10 answers to this question

Recommended Posts

  • 0

I'm sure this is possible. How about a Basic compiler instead of a new language?

There should be a few text editors on Github for the C64, which should be easily portable.

In any case I would go for assembler.

  • Like 2

Share this post


Link to post
Share on other sites
  • 0

Thank you for your comment. I'm planning on keeping it similar to BASIC but again I do want to add some features of modern languages like as was said before functions. I will look for a c64 text editors and try to port it. Thank you!

Share this post


Link to post
Share on other sites
  • 0

1/2. It's definitely possible to write a programming language for the X16, but it depends of what's your idea on it. Things like C should work fine (look for CC65 if you want), but something like Python, well, machines with a 8-bit CPU and KBs of memory don't meet the requirements to make it work fully. Maybe you can make a language with a syntax similar to Python, but you won't get all of its features. It really depends of the features you want to add and whether they're feasible on such a low-spec machine.

3. Otherwise, making an IDE directly on the X16 for your language would be pretty cool, go for it 🙂

4. In the end, the choice of the language to implement it in is up to you, but Assembly or C would definitely be more efficient.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Thank you for the response I think i’d like base camp to be similar to c but with the flexibility of python(if it’s possible with the x16 hardware). Before I start I’m going to create an ide or some kind of text editor so I can work on it in the emulator. I’m just researching what the best method of creating the text box would be(message me if have any idea). Well anyway Thank you!

Share this post


Link to post
Share on other sites
  • 0

Honestly, I would love language/IDE like that on X16!

I know that X16 is supposed to be a hobbyist computer that will take you from BASIC to assembler first and foremost, but I am nowhere close on my programming journey to deep dive into assembler, and I find MS BASIC 2 a bit limiting. A middle ground that runs on the hardware itself would be awesome.

If you think of making a fully blown IDE, have a look at what fantasy consoles (Pico-8 or TIC-80 to start) are doing. Those are great modern tools that let people get into programming (this is how I got into programming over a decade after my first tries with QBASIC). The great thing about them is that they blend contemporary and retro practices - sure, you have functions and pretty much all of lua capabilities, but you still don't need to learn a whole engine - the instruction set is prosperously limited. They are also a "one stop shop" for game making, letting you code, make gfx, sfx and music all from within the software (not sure how feasable that would be on X16, but it would be a dream come true, for a newbie like me).

 

Share this post


Link to post
Share on other sites
  • 0

Everything will be driven by your requirements and the hardware's abilities (limitations).

Then, your success will probably depend on how to break down the project into milestones.  And as much as you dislike interpreters, your first milestone *could* be implementing a bytecode that Base Camp will then be built on top of.

(In other words, I think Lua could add some inspiration here.)

Milestone two: your parser generates that bytecode, and your bytecode interpreter runs it for development purposes.

Your third milestone could then be writing a compiler that turns those bytecodes into machine language.

Note that it might be handy to have both a compiler and an interpreter.

* * *

Anyway, a modern BASIC with Pythonesque qualities is possible.  I've seen BASICs out there which have modern flow control (functions) and no line numbers.  Base Camp would be an order of magnitude better than BASIC2.0 if it only had that.

 

Share this post


Link to post
Share on other sites
  • 0
On 7/15/2020 at 2:30 AM, rje said:

Anyway, a modern BASIC with Pythonesque qualities is possible.  I've seen BASICs out there which have modern flow control (functions) and no line numbers.  Base Camp would be an order of magnitude better than BASIC2.0 if it only had that.

 

The very next generation of Microsoft Basic, ]IBM BASICA -> GW-Basic] OOPS, Edit: QBasic [thanks for catching that] had functions/procedures with local variables and no line numbers required, with line numbers, if used, just acting as a way to specify a label.

This was followed by a compatible Basic compiler, so you could develop with the benefit of an interpreted language and then compile it for faster execution.

 

Edited by BruceMcF

Share this post


Link to post
Share on other sites
  • 0
8 hours ago, BruceMcF said:

The very next generation of Microsoft Basic, IBM BASICA -> GW-Basic, had functions/procedures with local variables and no line numbers required, with line numbers, if used, just acting as a way to specify a label.

This was followed by a compatible Basic compiler, so you could develop with the benefit of an interpreted language and then compile it for faster execution.

 

I don't know what GW-Basic you were using, but every version I saw required line numbers. QBasic was the first MS BASIC for DOS that let you use labels instead of line numbers.

Share this post


Link to post
Share on other sites
  • 0
46 minutes ago, SlithyMatt said:

I don't know what GW-Basic you were using, but every version I saw required line numbers. QBasic was the first MS BASIC for DOS that let you use labels instead of line numbers.

I agree. BASICA and GW-BASIC require line numbers. And there are no functions/procedures with local variables, you have to use GOSUB and RETURN.

Share this post


Link to post
Share on other sites
  • 0

Yes, QBasic. My fault for looking at the first source I found instead of getting to my original sources.

I did my PC programming for my dissertation in C and AWK, so my hands on Basic experience tapped out with Commodore Basic v7.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use