I still want to reformat my computer, but I'm not under the gun about it yet. I want to do it around the end of the semester, so I have some time to research it first. I do want to switch over to Linux for the work computer. It's an IBM laptop, and I hear there is good support for those now. I am also going to price out a solid-state HDD, since I'm worried about the health of my current drive.
I've been working to implement some of the basics of the Octave language, and trying to teach myself how to use the Parrot Compiler Tools in the process. However, I've reached the critical juncture where I need to add two of the most important components: matrices and subroutines. The problem is that in MATLAB/Octave, both subroutine calls and matrix indices use the same syntax: ident(args). This means we need to determine whether we are calling a subroutine or indexing a matrix when we see this construct. Here are the rules I've worked out for it so far:
- If the index is an lvalue, like "x(a) = b", it must be a matrix. MATLAB/Octave does not support lvalue function calls, that I know of
- Functions, as I've mentioned before, are located in similarly named files. That means that my interpreter isn't going to maintain a list of all defined functions, but will instead search the filesystem when a function is called. So, I can't test a list of defined functions when trying to differentiate between the two.
- I will need to maintain a list of variables. When I see an rvalue with parenthesis, I check the list of variables to see if it is one, and then start searching the filesystem for a file/function with that name. If this fails, throw an exception.