• Welcome! The TrekBBS is the number one place to chat about Star Trek with like-minded fans.
    If you are not already a member then please register an account and join in the discussion!

Basic compiler for Linux?

As I understand it, the VBA available in Excel for more complex macros is derived from the BASIC of old, right? Is it still similar enough that VBA could run the BASIC code, or could the BASIC code be adapted for VBA in Excel?

VBA is a cumbersome blend of basic, the syntax used in spreadsheet formula, as well as adding some quirks of it's own. I don't personally like it, but it should be possible to copy and paste the code, then do whatever changes are needed to make it compatible with VBA. That may be a few hours of work, depending how long the code is.

This is assuming it is actually written in basic (as your boss says it is), rather than fortran or pascal. :p
 
BASIC came before C, so it doesn't have most of the characteristics we've come to associate with C-style languages.

Well give that C gave us pointers and obscure syntax that's probably a good thing :)

Pointers are a necessity. Some languages try to hide them from the coder, but it's pretty obvious where they are being used "under the hood" in such cases.

Not that I think such hiding is a bad thing; I'm very much in favor of hiding real pointer use in as tight a scope as possible, instead favoring smart pointers, iterators, containers, and other such higher-level constructs most of the time.
 
Basic has pointers too, but they're not often used:

Code:
DIM a, x, y as Integer

LET x = 4
LET y = 1

LET a = VARPTR(x) // get address of variable x

LET y = PEEK(a) // read the integer at address a

PRINT y; // it will print 4

LET y = 7
 
POKE a, y // write to the integer stored at address a

PRINT x; // it will print 7
 
Last edited:
BASIC came before C, so it doesn't have most of the characteristics we've come to associate with C-style languages.

Well give that C gave us pointers and obscure syntax that's probably a good thing :)

Pointers are a necessity. Some languages try to hide them from the coder, but it's pretty obvious where they are being used "under the hood" in such cases.

Not that I think such hiding is a bad thing; I'm very much in favor of hiding real pointer use in as tight a scope as possible, instead favoring smart pointers, iterators, containers, and other such higher-level constructs most of the time.

I prefer a language just be really obvious about its default behavior--does it pass by value or reference, and can you control which it's doing?

Perl lets you control this to your heart's content, but if you pass something by reference rather than by value you have to treat it differently inside your function, if it's a multi-value type such as an array or hash.

Python passes values for immutable objects, and a (non-mutable) reference for mutable objects. Meaning you can change the properties of an object you pass in, but you can't actually change which object you're pointing to--the reference itself is a value and not mutable.

MUMPS, uh... technically, everything is floating around by reference by default, unless you use NEWs and parameter-passing. You put a "." in front of anything you want to pass by reference, and arrays must always be passed by reference if you want it to work right.
 
Uh oh we're in need of one of those internet, compare the programming languages joke sheets.

None the less basic is just that, and if the algorithm is reasonable a macro could do the trick. Although it's a non-trivial task.

And Robert every time I hear that you are doing MUMPS programming I can smile and go back to my code and think, "It could be a whole lot worse...."
 
I don't have joke sheets, but I can serve thee with a quiz...

http://www.bbspot.com/news/2006/08/language_quiz.php

I am...
perl.jpg

(hotlinking is permitted by bbspot)
 
That quiz said I'm LISP. Bullshit! I hate LISP. A lot. Take your alphabet soup with fingernail clippings and shove it!
 
The data files are essentially a spreadsheet with the data in columns and rows. The program sorts the rows based on similarity of the data in the columns to group samples based on similarity using an algorithm in the original code. It can also sort the columns based on the data in the rows to find similar patterns. These data files come from Excel, and it occurs to me that this is something that Excel might be able to just as well, if not better, with a properly developed macro. As I understand it, the VBA available in Excel for more complex macros is derived from the BASIC of old, right? Is it still similar enough that VBA could run the BASIC code, or could the BASIC code be adapted for VBA in Excel?


LOL, before I got to your 3rd sentence I was thinking, "heck, that can be done in Excel pretty damn easily". Don't waste your time trying to save an old program. Make a spreadsheet that can do the same function. -Bonus, you'll be able to make shiney charts of the data.
I just got the files from my boss. It turns out it's actually 14 separate executable files that do different things with one other that is essentially a menu to call the appropriate one of the others depending on what the user wants to do. Many of those functions are ones that could be easily done in a spreadsheet, such as combining or splitting data files.

The real function I need, however, is more complicated in a spreadsheet. As I said, I need to sort the rows based on the data in the columns. That sounds easy, except there may be as many as 500-1000 columns, and the sorting process needs to take into account the data in all the columns at once. What's more, the data is simply the numbers 0, 1, 2, 4, 6, or 8 representing the likelihood that something is present in a sample. 0 is no data, meaning it should be ignored, whereas 1 is negative, or the item is known to be not present. 4 and 6 are considered equivalent, as are 6 and 8, but 4 and 8 are not. So, it's much more complicated than just a simple sort.

I need to get the source from my boss to see how it's implemented and see if there's any easy way to do it in a spreadsheet. The only real reason the columns and rows need to be grouped in such a way is to so that one can look at the data and visually pick out blocks of data. I may be able to devise some sort of spreadsheet function that can look at all the data for a sample, compare it to known patterns and find the patterns that are present in the sample. That wouldn't allow the same data to be identified visually, but it should yield the same results. (Sorry if that doesn't make much sense to you all.) Hmm...I'll have to give that some thought.
 
It sounds like a relatively easy program to write, but it's hard to understand the algorithm from your description.

To write the program, the questions you'll need to answer are: How exactly are two rows being compared? What is the criteria for adding a row to a group? How do we know when we should create a new group? How should the first entry in a group be decided if there's nothing else to compare it with? How should entries in a group be sorted? How should the list of groups be sorted?
 
Mostly I just stick to C++, personally.

Hard to go wrong with C++... except for when you do. ;)

My biggest complaint with the language is how many people think they know it, but really only know "C with Classes."

It's amazing how many people are confounded when I apply an STL algorithm, never mind something like the erase-remove idiom.

I can understand being intimidated by Boost constructs, but you really should know the standard library if you call yourself a C++ programmer....
 
Mostly I just stick to C++, personally.

Hard to go wrong with C++... except for when you do. ;)

My biggest complaint with the language is how many people think they know it, but really only know "C with Classes."

It's amazing how many people are confounded when I apply an STL algorithm, never mind something like the erase-remove idiom.

I find a lot of programmers don't really understand object-oriented paradigms at all, and just think of classes as collections of functions and members.

One of the things that drives my coworkers crazy is when I use code generators and introspection to do a lot of the heavy lifting. What can I say? I'm lazy.
 
It sounds like a relatively easy program to write, but it's hard to understand the algorithm from your description.

To write the program, the questions you'll need to answer are: How exactly are two rows being compared? What is the criteria for adding a row to a group? How do we know when we should create a new group? How should the first entry in a group be decided if there's nothing else to compare it with? How should entries in a group be sorted? How should the list of groups be sorted?
Yeah, I don't understand it myself. What I wrote above is basically all the explanation I got of it. I realize I'm going to need to know a lot more about it if I'm going to try to recreate it. It's all described in my boss's dissertation. I expect if I decide to recreate it in a spreadsheet I'll have to go read that, and that's probably where I'll have to go to get the source code if I need that as well.
 
I expect there'll be some sort of metric d that calculates the "distance" between two vectors (rows) A and B.

eg, for the taxicab/manhattan metric, you'd have: d(A,B) = ∑|Aj - Bj|

Here you'd want: d(A,B) = ∑ f(Aj, Bj)
where
f(0,*) = 0
f(4,6) = 0
f(6, 8) = 0
etc
 
And Robert every time I hear that you are doing MUMPS programming I can smile and go back to my code and think, "It could be a whole lot worse...."
Yeah, you could code with Brainfuck.
Personally, I've come to like C# a lot.
 
If you are not already a member then please register an account and join in the discussion!

Sign up / Register


Back
Top