Repository navigation
Description
Hello, good afternoon colleagues.
Let's talk about a low level first.
Low level
As you already know, the compiler supports low-level arithmetic operations like...
$x += 1.5
$y -= 2
$x /= 3.1415
which save us some time searching for the opcode.
If you are like me, surely you quickly realized that these shortcuts only work to assign a static value, NOT VARIABLES!
$ += @ // ERROR
$ += 12 // ok
and if we change this for this....
var
@ = 6
$ = 7
end
$ += @
//EEEEEERROOOOOR!!!!!
Although there are the opcodes for them, which range from 0058 to 0077.
I was wondering if the compiler could extend that small capacity that goes from 0004 to 0046, to have fewer errors when jutar operations like...
$ += $ //nice!
$ += @//good!
@ += @//exelent!
@ += $ //PERFECT!!!
do you think it is possible to add that function?
And do you think that would be cool?
- It'd be great!
- First option!
High level
And if you could do long calculations and have the compiler cut them, to analyze which opcode they belong to?
Variables
var
$321 : float = 0.1
20@ : float = 2.5
12@ : float = 46.324
$482 : float = 3.333
end
Syntax
calc
1@ = $321 * 20@ + 12@ / $482
end
Compilation -->
$321 *= 20@
12@ /= $482
$321 * = 12@
1@ = $321 // 1@ = 14.1485899
Well, I don't know what language you use, but previously, at the university, they had told me to do something similar in C #, and I remember that it was done with System.Text.RegularExpressions. Also in JavaScript .... It is easy, but somewhat confusing the system, but it would be somewhat satisfactory if the IDE already has it by default, so as not to have to use an app that hosts on the internet... haha
Mi inglés es terrible, pero espero que lo entiendas todo. 👍
Activity
x87 commentedon Aug 21, 2020
@MatiDragon-YT
this works, compiles to 005E.
complex expressions are fine and easy to implement until we got to the point where we need to introduce a temporary variable to calculate the result. consider:
this should unwrap to:
which is again possible to implement but requires extra memory managements. Due to limits on variables the compiler can't arbitrarily add more hidden variables (neither global, as it affects the main.scm layout by increasing varspace in the header, nor local as their amount is very low). Here is the dilemma, how to circumvent it.
x87 commentedon Aug 21, 2020
custom local variables #32 is actually a one step closer towards supporting features like this as we hide some low-level details from the user and let the compiler deal with variables under the hood.
MatiDragon-YT commentedon Aug 21, 2020
You are absolutely right @x87 , in fact the IDE compiles those opcodes well ..... Unless ..... heheheeee....... use variables from the constants.txt file... hohohoo~ 😱

the same is true of the {$ I} directive as well.
is this a compiler error, or a programmer error? (me)
x87 commentedon Aug 21, 2020
@MatiDragon-YT I see. You can't use constants defined in
constants.txtin this way, as there is no type defined for them. They are simply aliases. You would need to first tell the compiler the type:although I think sometimes the compiler could infer the type from the value that has been assigned to it (0.5 means float), but Sanny is not that smart yet.
MatiDragon-YT commentedon Aug 21, 2020
uhmm... oh, okay... and thank you very much for your attention to my questions.
MatiDragon-YT commentedon Sep 25, 2020
These opcodes that you implemented in CLEO2 could be supported
so they can be used like this
x87 commentedon Nov 7, 2020
this has been implemented in v3.6. now in statements like
var = op1 (+-*/) op2wherevar,op1orop2is an integer value or variable the compiler uses CLEO opcodes. e.g.