Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
micro(A)v11
#61
First part is this function in Java
(anyone interested ? )  [Image: grin.png]

Quote:function doUserFunctionAssignment() {
' //IJ.log("doUserFunctionAssignment0: "+pgm.decodeToken(token, tokenAddress));
putTokenBack();
int savePC = pc; ' pc is program counter
getToken();      ' // the variable
getToken();      '// '='
getToken();      '// the function name
        'example in BASIC way ... -> v = myfn()
bool simpleAssignment = isSimpleFunctionCall(true);
pc = savePC;
If (!simpleAssignment)
getAssignmentExpression();
Else {
getToken();
Variable v1 = lookupLocalVariable(tokenAddress);
If (v1==null)
v1 = push(tokenAddress, 0.0, null, this);
getToken();
If (token!='=')
error("'=' expected");
getToken(); // the function
Variable v2 = runUserFunction();
If (v2==null)
error("No return value");
If (done) Return;
int type = v2.getType();
If (type==Variable.VALUE)
v1.setValue(v2.getValue());
Else If (type==Variable.ARRAY) {
v1.setArray(v2.getArray());
v1.setArraySize(v2.getArraySize());
} Else
v1.setString(v2.getString());
}
}
Reply
#62
anyone know Java?
Is this part meant to be NOT ?

If (!simpleAssignment)
    getAssignmentExpression();
Else {

i mean is that like in BASIC

IF NOT ( simpleAssignment ) THEN
     getAssignmentExpression() ' call function
Reply
#63
more modification to BASIC like syntax:

Quote:''user functions

function setupArgs(int nArgs) {
getLeftParen();
int i = topOfStack;
int count = nArgs;
If (nextToken() <> ")" ) then
do {
  getToken()
  If (i>=0)
  stack[i].symTabIndex = tokenAddress;
  i = i - 1
  count = count - 1
  getToken()
} While (token = "," )
putTokenBack()
}
If (count <> 0)
  'error(nArgs+" argument"+(nArgs==1?"":"s")+" expected");
getRightParen();

end function
Reply
#64
in above functions i don't know what is this type of LOOP

Is this Do /While Loop ?
or both
or While Loop inside Do Loop ?
any comment ?

tnx
Reply
#65
do {} while in C or Java is like:

Code: (Select All)
DO
:
LOOP WHILE (condition)

in QuickBASIC, Commodore-128 BASIC, QB64 and many many others.

There is no other counterpart to REPEAT... UNTIL like Lua and Pascal. Without "LOOP UNTIL (condition)" you must use NOT like a function if you have a big condition but you need to break out of the loop if that condition is false.
Reply
#66
@aurel I highly recommend for your sake and your MicroA project that you do not go down this path/rabbit hole here in your own MicroA thread. I do appreciate your attempts to help with this challenging subject but I fear you lose what fans and following you may have for MicroA here. Maybe at your forum which is more appropriate for such a topic since we have a few language developer hobbyists there and no single Basic Language dominates.

In other words going off on Java is sidetracking your own thread.
b = b + ...
Reply
#67
Agreed but Aurel is also trying to improve micro(A). Smile

I don't know what he's going toward. But I'm afraid I made too many demands. I guess I was used to an interpreter that could handle files either in sequential access for text, or in random access for "array data". Also coming across an interpreter which has only one loop construct which cannot be "taught" to count and could only test at the top. It's strange now he's asking for help about how to do a loop which tests at the bottom?

I don't think improving micro(A) should rely on JavaScript or any other programming language source. Is any portion of the project being done with Oxygen BASIC? If it requires recalling anything in JavaScript then it's a serious conflict. I can understand where sometimes code needs to be "borrowed" from another language. But in the examples displayed there are too many holes: what does "getToken()" function do? Why show only a high-level function?

I'm sorry if this sounds like a criticism, but we could expect micro(A) to be improved. It will depend on the exuberance of the author.

A thought just came to me. Does Oxygen BASIC have an "import" feature which doesn't include DLL or SO, which allows to look at "foreign" code? Something like doing "dot-H" files in QB64 with C/C++ code. Oh well but I guess such a trick could only be done by a front end for its target. In other words, Oxygen BASIC isn't creating code internally for JavaScript which then has to produce an EXE file.

That case might require compiling to a separate shared library anyway which has to be "summoned" by code in Oxygen BASIC.

micro(A) already has to load a "scilexer.dll" that seems to be closed source.
Reply
#68
Oh boy..
Sorry if i made confusion Big Grin 
I am little bit weird but i know that every language have "something" good & bad
depends how you look on concrete things.

it is not JavaScript than pure Java code and is not weird to me
in fact i found it very good and easy to translate and modify to Oxygen Basic
so there is no any BIG problems with that .

OxygenBasic can load any CDCL based .dll and can read C headers or include files directly .
And also can build .dll which can be used with qb64 too
But that is another thing.

Potential fans will go crazy when they see Java code ..come on Wink 
Yeah i agree it is better for basic4us forum
but this is just few functions about string extracting
and i know that can be done in QB64 for sure ...
of course with little different syntax

micro(A) don't  have nothing with scilexer.dll ..
scilexer.dll is used with AurelEdit code editor ..not with micro(A) Interpreter
Sintilla is open source if you don't know ..and scintillaGTK is used by many open source
code editors on Linux ..like Geany and Anjuta
Reply
#69
Yeah if this is about User Defined Functions in MicroA, yes go for it man! Love to see that no matter how you get there Smile
b = b + ...
Reply
#70
Yes ..just for testing purpose
and to see if i can translate it ..
but can be universal for any interpreter.
Reply




Users browsing this thread: 10 Guest(s)