Jump to content
IGNORED

FastBasic syntax highlighter for VS Code


Recommended Posts

Hi all, I just found dmsc's FastBasic and I am quite enamored with it!

 

I use VS Code for my non-Atari coding projects, so I created this tiny FastBasic syntax highlighter that works in VS Code. It's brand new, so I'm sure I have missed some things. Please let me know if you use this and find it useful, and especially if you see any highlighting mistakes / missing features!

 

- You can find it in VS Code, just search the extensions for "Atari FastBasic"

- Or VSCode Marketplace Link: https://marketplace.visualstudio.com/items?itemName=BillyCharlton.atari-fastbasic

 

Might add a build/run-in-emulator button...

 

Cheers

Billy

 

Edited by billyc
  • Like 6
  • Thanks 2
Link to comment
Share on other sites

Excellent! I had been using Visual Studio Code and the highlighting was annoying me.

 

I will probably check this out tomorrow as my Good Friday treat.

 

Thanks for your work.

 

Edit: I couldn't wait, so I am trying it now. All seems good so far, no bugs found yet. Top man!

Edited by snicklin
Patience underload
Link to comment
Share on other sites

Cool. I'm curious -- how have you set up your development environment? Meaning, did you set up some sort of build process inside VS Code?

 

I want to streamline the edit/compile/run/debug cycle. I'm going to write a Makefile which rebuilds an .ATR every time the file saves, but something more "integrated" would be a much better solution.

Link to comment
Share on other sites

Oh I am not that sophisticated!
 

I edit in VS Code and now have a batch file that concatenates my "library" (.bas) files onto the end of the main code. This then calls the fb-int  batch file which compiles my appended together code to a .xex file.

 

I haven't spent long on the build process. With other projects I have gone into more depth, but not within VS Code.

 

This is the current state of play, but I will be working on integrating external assembly soon.

 

---

Edit:

Just for interest purposes, if anyone is interested, here is my very simple Windows batch file for concatenating files together and then compiling them...

Copy MyBas\MyGame.bas + MyBas\General.bas + MyBas\Graphics.bas + MyBas\Text.bas Game.bas /b
fb-int Game.bas

 

Edited by snicklin
Add details of build file
Link to comment
Share on other sites

12 hours ago, billyc said:

Cool. I'm curious -- how have you set up your development environment? Meaning, did you set up some sort of build process inside VS Code?

 

I want to streamline the edit/compile/run/debug cycle. I'm going to write a Makefile which rebuilds an .ATR every time the file saves, but something more "integrated" would be a much better solution.

You've inspired me to improve my build cycle. I've always liked good build systems, but never got to it for FB. I wrote a build system for HP in the early 2000s and have dabbled since then.

 

I've had a quick go at this, this is what I've come up with so far. No ATR creation yet, this is something I may look at later.

 

In VS Code, I went to Terminal->Configure Tasks->Build . Then I deleted the auto-created nonsense and added the following.

 

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version""2.0.0",
    "tasks": [
        {
            "label""build",
            "type""shell",
            "command""C:/Users/Steve/Desktop/FastBasic4.5/Build.bat",
            "presentation": {"echo"true"reveal""always""focus"false"panel""shared""showReuseMessage"false"clear"true},
            "group": {"kind""build""isDefault"true},
        }
    ]
}

 

Then in my Build.bat, I now have....

 

set MYDIR=C:\Users\Steve\Desktop\FastBasic4.5
set BASDIR=%MYDIR%\MyBas
set OUTPUT=Game
 
IF EXIST %MYDIR%\%OUTPUT%.bas del %MYDIR%\%OUTPUT%.bas
IF EXIST %BASDIR%\%OUTPUT%.xex del %BASDIR%\%OUTPUT%.xex
 
Copy %BASDIR%\SteveTris.bas + %BASDIR%\General.bas + %BASDIR%\Graphics.bas %BASDIR%\%OUTPUT%.bas /b
Call %MYDIR%\fb-int.bat %BASDIR%\%OUTPUT%.bas
 
REM Next line will auto-call Altirra through Windows file association
IF EXIST %BASDIR%\%OUTPUT%.xex call %BASDIR%\%OUTPUT%.xex

 

Press Control-Shift-B and it now builds and runs.

Edited by snicklin
  • Like 1
Link to comment
Share on other sites

@snicklin

A quick question for you, since I have your attention. ?

 

When the source code has compile errors, I don't get any useful error messages from fb or fb-int at all. All I get is "Abort trap: 6".  Every time.

 

This can't be normal, can it? I see you're on Windows so I'm wondering if this is something wrong with the recent Mac M1 builds.

 

When I run "fastbasic-int -d myfile.bas" I can see lots of things happening in the output, including properly identifying line 5 as the problem. (I added a line number to one line just to be cheeky). It stops compiling on the line with the mistake, but no error message saying line 5 is the problem.

 

What do you see when you have errors?

 

Thanks!

Billy

 

Link to comment
Share on other sites

Hi!

1 hour ago, billyc said:

A quick question for <you, since I have your attention. ?

 

When the source code has compile errors, I don't get any useful error messages from fb or fb-int at all. All I get is "Abort trap: 6".  Every time.

 

This can't be normal, can it? I see you're on Windows so I'm wondering if this is something wrong with the recent Mac M1 builds.

That is not normal.

 

I cross-compile the OSX version from Linux, and as I don't have any Mac (and specifically, don't have an ARM based Mac), I can't test the resulting binary, so I simply assume that if it fails users will complain ? 

 

IMHO, if you have a M1 based Mac, best would be for you to compiler your own version. You need to install GIT to download sources and the C++ compiler, I think that using "xcode-select --install" is the proper option. Then, just type "make test" for building the compiler and running the test suite, this will inform you of any problem when running the compiler.

 

 

1 hour ago, billyc said:

When I run "fastbasic-int -d myfile.bas" I can see lots of things happening in the output, including properly identifying line 5 as the problem. (I added a line number to one line just to be cheeky). It stops compiling on the line with the mistake, but no error message saying line 5 is the problem.

 

What do you see when you have errors?

The compiler should output an error message with the line/column of the error.

 

If you can't compile your own version, you can send me your source code to see if I can reproduce the failure in my Linux notebook (I can test on Linux x86, amd64 and also ARM boxes).

 

Have Fun!

Link to comment
Share on other sites

26 minutes ago, dmsc said:

Hi!

That is not normal.

 

I cross-compile the OSX version from Linux, and as I don't have any Mac (and specifically, don't have an ARM based Mac), I can't test the resulting binary, so I simply assume that if it fails users will complain ? 

 

IMHO, if you have a M1 based Mac, best would be for you to compiler your own version. You need to install GIT to download sources and the C++ compiler, I think that using "xcode-select --install" is the proper option. Then, just type "make test" for building the compiler and running the test suite, this will inform you of any problem when running the compiler.

 

 

The compiler should output an error message with the line/column of the error.

 

If you can't compile your own version, you can send me your source code to see if I can reproduce the failure in my Linux notebook (I can test on Linux x86, amd64 and also ARM boxes).

 

Have Fun!

Thanks @dmsc -- I also filed a bug report on Github with more details. It's not an M1 problem; it might be a Billy problem ?

 

I'll let you know what I can figure out. I'm new to Mac but very familiar with building on linux/windows so hopefully I can get some clues as to what I'm doing wrong.

 

 

Link to comment
Share on other sites

4 hours ago, billyc said:

Yes, exactly! I will add a build task to the extension, but we need the upcoming fastbasic include-file semantics to really make it work correctly and generically. This is exciting!

Yes, what I am doing at the moment is a temporary measure which suits FB as it is currently in time. And yes, it is very exciting, but I will hold back for now and make the most of what we have because there are no timelines for enhancements.

 

As regards to your error, yes, seems like a Mac issue as I do not get such messages. You could either rebuild it as mentioned or do you have any Windows VM's on the Mac? (Or Wine, does it work with that?)

Link to comment
Share on other sites

@dmsc - I'm replying here instead of Github so the discussion chain isn't broken. ?

 

Yep -- compiling it myself solved the problem. I had to add one C++ flag to the Makefile: "--std=c++14" and then it compiled cleanly without any warning messages. The tools now all work perfectly and the error messages on compile are being emitted properly instead of crashing! Woohoo!

 

But... this doesn't help you fix the public builds. I can't tell you what is wrong with them (yet) but I did find a bunch of discussions about "Abort trap: 6" online, see these in particular for some hints:

 

https://developer.apple.com/forums/thread/119429

https://dbaontap.com/2019/11/11/python-abort-trap-6-fix-after-catalina-update/

 

It sounds like in 10.14 Catalina and above, Apple changed the way shared library versions are linked. Maybe that's enough of a hint?

 

Let me know if I can help test/troubleshoot further!

Billy

 

Edited by billyc
Link to comment
Share on other sites

Hi!

17 hours ago, billyc said:

I'm replying here instead of Github so the discussion chain isn't broken. ?

 

Yep -- compiling it myself solved the problem. I had to add one C++ flag to the Makefile: "--std=c++14" and then it compiled cleanly without any warning messages. The tools now all work perfectly and the error messages on compile are being emitted properly instead of crashing! Woohoo!

 

But... this doesn't help you fix the public builds. I can't tell you what is wrong with them (yet) but I did find a bunch of discussions about "Abort trap: 6" online, see these in particular for some hints:

 

I updated my OSX-CROSS build tools, and attached the resulting executables in the Github bug report, please if you can test them perhaps that was all that is necessary.

 

Thanks!

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...