I feel more confortable working in C++,is the developers language #1. It will always be.
Nearly avoided problem,now I have to reeavluate the hall parser(runtime Parser).
There is a bug in Pure Basic that's why my Split Token Lines procedure does not work correcly, the WHILE...WEND and FOR...NEXT cycles take's one more unnecessary loop,or so.
Is when Runtime Parser is trying to split the tokenised lines. Does not split it out instead it's concatenating the lines , the CR is missing the Main Parser didn't added to the lines.
The DATA problem come's because I tryed to handle it through an intermediary variable (expression$).
READ does not declare the variable so.
Now it's time to fix what I wrote. It's not fully wrong how I wrote it only I probably ommited some parts.
Liberty Basic Plus RUNTIME PARSER is COMPLETE today April 19,2018 by Cretu Gheorghe-Andrei
In Liberty Basic wherever you declare DATA ,the values are readable. So here's a problem to solve after I almost finished function calls in Math Interpreter.
if BREAK occures whitout an IF will still execute the cycle until NEXT
I designed BREAK and FOR...NEXT to use the stack. I am not happy with them.
What if someone write's the code this way:
10 FOR x=1 to 20 step 2: print x: if x>10 THEN BREAK:NEXT X
It is a valid LB+ program.
The Compiler doesn't handle yet the user defined functions.
So that's what I'll do today.
I haven,t wrote END FUNCTION and END SUB Parsers I will add BREAK as EXIT FOR\WHILE\DO , because I think is helping the programmer to pass to C++ in the future,plus it makes the job a lot easier for evryone.
Global Variables will use the Heap Memory,LOCALS will be pushed onto the Stack.
As is now,depends how "deep" you go,for example:
FOR A=1 TO 10
FOR B=1 TO 10
FOR C=1 TO 10
<block>
NEXT C
NEXT B
NEXT A</block>
Will push on the stack variables A,B,C into this order.
when NEXT will be found , the compiler will pop the stack.
if the stack pointer meets the Heap pointer you'll have STACK OVERFLOW Error.
I'm trying to focus myself on the array issue. Why? Because it's important how I'm allocating memory. If a programmer will like to create an Array in LB+:
DIM A(20,20+1)
and then declare one specific item of that array"
Let A(1,1) = LN(17)
I have to be sure that at the address of that item the value of LN(17) is written,so later when:
something like:
PRINT A(1,1)
occurs: to read that right from the memory.
The parser wasn't jumping over NEW LINE character as it should,but now,it does.
Cretu Gheorghe-Andrei
I have putted my code into the mirror.
I have watched close.
I realise now that I did a mistake,or,I was going to.
Variables can be declared in GLOBAL and LOCAL scope in Liberty Basic.
I'm not providing you with the the GLOBAL Keyword yet.
This code:
let x=1
function f(a)
f = a+x
end function
it has a variable x which is global,a variable a which is local.
Tokeniser \ Parser procedure for PRINT Statements was getting one more char. Too much. FIXED IT. I have tested several strategies to tokenise faster. None of it
worked,so, for now, the project will stay just as it is.
Tokeniser \ Parser procedure for PRINT Statements was getting one more char. Too much. FIXED IT. I have tested several strategies to tokenise faster. None of it
worked,so, for now, the project will stay just as it is.
Okay my new strategy is to mimic the LB Way of parsing after I found my ideea involves a lot of work and it doesn't work as I expected.
Today April 17 I discovered that Main Parser has bugs. It does'nt output the desired result.
I will adopt now a different perspective.
Cretu Gheorghe-Andrei
If crosses your mind to BUY this product from another site, This product is free of any charge or fee. Liberty Basic name is the intellectual property of Carl Gundel and Shoptalk Systems. This is a derived product that does not exploit the full capacity of Liberty Basic,and will not try to mimic Liberty Basic features integrally. This software has several different features under GNU PUBLIC LICENSES.
If crosses your mind to BUY this product from another site, This product is free of any charge or fee. Liberty Basic name is the intellectual property of Carl Gundel and Shoptalk Systems. This is a derived product that does not exploit the full capacity of Liberty Basic,and will not try to mimic Liberty Basic features integrally. This software has several different features under GNU PUBLIC LICENSES.
Now that I finished parseing the syntax,IT'S TIME.
It's time to check for Runtime Errors.
For that I have builded an Mathematicle Interpreter. The Interpreter has to solve corectly any (or nearly any) kind of mathematical problem.
Why do we need the runtime parser?
Simply because first time we checked out how we spelled PRINT 1+1/x.
Now we will check if 1/x is or is not 1/0,which will cause an Error.(Division by zero).... read more
After 2 days of figuring out how to do it (is the best option or not) I have finished the Syntax Parser for several Liberty Basic Plus Statements.
today April 15,2018
Cretu Gheorghe-Andrei