Page 1 of 1

PBScript runtime interpreter

Posted: Tue Mar 03, 2026 3:09 am
by idle
v 0.8
supports "+, - * / % & | ! << >> ~ and negation
print, sqrt, pow, abs
FFI functions to runtime procedures, somewhat limited
If else elseif endif
for next with step
while wend
Repeat forever with break and continue
floating point loops
Structures ;currently uses New to declare structures p = New mPoint
Procedures ;not handling structures yet

This is purely AI generated 8 edits, I just told it what I wanted and it works :shock:
I'm not sure what I think. :?

download with test code here
https://Atomicwebserver.com/PBScript.zip

Re: tiny runtime script

Posted: Tue Mar 03, 2026 9:21 am
by Little John
Very cool! 8) Thank you so much! :thumbsup:

There is a tiny cosmetic issue:
You are opening a console which is not used, since the whole output of your code goes to the Debug window.
Then the 'Input()' command is waiting for closing the empty console. ;-)
Thanks again!

Re: tiny runtime script

Posted: Tue Mar 03, 2026 8:19 pm
by idle
I posted as it was.
I also asked it to do a trampoline function wrapper directly outputting machine code to virtualprotect memory so we could call arbitrary functions.
What would take me a couple of days to do it spat out in seconds, though it's x64 windows only and needs a bit more work plus it's rather lengthy but very cool that it compiles a function prototype then patches it with the variables and calls it but it would possibly freak out AV's

I asked it to add if elseif, for next with step, while, forever loops with break and continue and apart from some minor issues it worked, think I might retire now. :lol:

I will try to coerce it into accepting actual PB code once it's done strings on FFI but I'm still looking at how to get around the type limitations. It's not far from PB syntax.
Claude is becoming surprisingly capable.

download with test code here
https://Atomicwebserver.com/PBScript.zip

Re: PBScript runtime interpreter

Posted: Wed Mar 04, 2026 7:55 am
by Little John
Thank you for expanding the code! It's educational and impressive.

Re: PBScript runtime interpreter

Posted: Wed Mar 04, 2026 8:13 am
by idle
Little John wrote: Wed Mar 04, 2026 7:55 am Thank you for expanding the code! It's educational and impressive.
unlike my usual slop :lol:
It's really quite good but It's a bit ugly in places though the c backend will fix most of that. I will do string returns sometime over next few days when I get time.

Re: PBScript runtime interpreter

Posted: Wed Mar 04, 2026 11:13 pm
by idle
here's the PB version of the test suite

Code: Select all

Macro Print(var) : Debug var : EndMacro
Runtime Procedure.d Add(a.d, b.d)      : ProcedureReturn a + b           : EndProcedure
Runtime Procedure.d Multiply(a.d, b.d) : ProcedureReturn a * b           : EndProcedure
Runtime Procedure.d Divide(a.d, b.d)
  If b <> 0 : ProcedureReturn a / b : EndIf : ProcedureReturn 0
EndProcedure
Runtime Procedure.i Factorial(n.i)
  Protected r.i = 1, k.i
  For k = 2 To n : r * k : Next : ProcedureReturn r
EndProcedure
Runtime Procedure.d Distance(x1.d, y1.d, x2.d, y2.d)
  ProcedureReturn Sqr((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
EndProcedure
Runtime Procedure.d Ctof(c.d) : ProcedureReturn c*9.0/5.0+32.0 : EndProcedure
Runtime Procedure.i IsEven(n.i)              : ProcedureReturn Bool(n%2=0)     : EndProcedure
Runtime Procedure.d Square(x.d)              : ProcedureReturn x*x             : EndProcedure
Runtime Procedure.i BitAnd(a.i, b.i)         : ProcedureReturn a & b           : EndProcedure
Runtime Procedure.i BitOr(a.i, b.i)          : ProcedureReturn a | b           : EndProcedure
Runtime Procedure.i LShift(a.i, n.i)         : ProcedureReturn a << n          : EndProcedure
Runtime Procedure.i RShift(a.i, n.i)         : ProcedureReturn a >> n          : EndProcedure

; ================================================================
; TEST SUITE - expected output shown as comments after each print
; ================================================================

; ---------------------------------------------------------------
; 1. TYPED VARIABLE DECLARATIONS
; ---------------------------------------------------------------
a.i = 42
b.d = 3.14
c.s = "hello"
Print(a) ; expected: 42
Print(b) ; expected: 3.14
Print(c) ; expected: hello

; ---------------------------------------------------------------
; 2. TYPE COERCION ON ASSIGNMENT
; ---------------------------------------------------------------
coerce_i.i = 9.9 ; truncates to 9
coerce_d.d = 7 ; promotes to 7.0
Print(coerce_i) ; expected: 9
Print(coerce_d) ; expected: 7.0

; ---------------------------------------------------------------
; 3. ARITHMETIC - INTEGER
; ---------------------------------------------------------------
i_add.i = 10 + 3
i_sub.i = 10 - 3
i_mul.i = 10 * 3
i_div.i = 10 / 3
; integer division = 3
i_mod.i = 10 % 3
Print(i_add) ; expected: 13
Print(i_sub) ; expected: 7
Print(i_mul) ; expected: 30
Print(i_div) ; expected: 3
Print(i_mod) ; expected: 1

; ---------------------------------------------------------------
; 4. ARITHMETIC - DOUBLE
; ---------------------------------------------------------------
d_add.d = 1.5 + 2.25
d_sub.d = 5.0 - 1.5
d_mul.d = 2.0 * 3.5
d_div.d = 7.0 / 2.0
Print(d_add) ; expected: 3.75
Print(d_sub) ; expected: 3.5
Print(d_mul) ; expected: 7.0
Print(d_div) ; expected: 3.5

; ---------------------------------------------------------------
; 5. UNARY MINUS
; ---------------------------------------------------------------
neg_i.i = -10
neg_d.d = -3.5
Print(neg_i) ; expected: -10
Print(neg_d) ; expected: -3.5

; ---------------------------------------------------------------
; 6. OPERATOR PRECEDENCE
; ---------------------------------------------------------------
prec1.i = 2 + 3 * 4 ; 2+(3*4) = 14
prec2.i = (2 + 3) * 4 ; (2+3)*4 = 20
prec3.i = 10 - 2 - 3 ; left-assoc = 5
prec4.i = 2 * 3 + 4 * 5 ; 6+20 = 26
Print(prec1) ; expected: 14
Print(prec2) ; expected: 20
Print(prec3) ; expected: 5
Print(prec4) ; expected: 26

; ---------------------------------------------------------------
; 7. STRING CONCATENATION
; ---------------------------------------------------------------
s1.s = "foo"
s2.s = "bar"
s3.s = s1 + s2
Print(s3) ; expected: foobar

; ---------------------------------------------------------------
; 8. BITWISE OPERATORS
; ---------------------------------------------------------------
bw_and.i = 12 & 10 ; 1100 & 1010 = 1000 = 8
bw_or.i  = 12 | 3  ; 1100 | 0011 = 1111 = 15
bw_xor.i = 15 ! 9  ; 1111 ! 1001 = 0110 = 6
bw_not.i = ~0      ; all bits set = -1
bw_lsh.i = 1 << 4  ; 1 * 16 = 16
bw_rsh.i = 256 >> 3 ; 256 / 8 = 32
Print(bw_and) ; expected: 8
Print(bw_or) ; expected: 15
Print(bw_xor) ; expected: 6
Print(bw_not) ; expected: -1
Print(bw_lsh) ; expected: 16
Print(bw_rsh) ; expected: 32

; ---------------------------------------------------------------
; 9. COMPARISON OPERATORS
; ---------------------------------------------------------------
If 5 < 10
  cmp1 = 1
Else 
  cmp1 = 0
EndIf 
If 5 > 10 
  cmp2 = 1
Else 
  cmp2 = 0 
EndIf   
If 5 <= 5
  cmp3 = 1 
Else 
  cmp3 = 0
EndIf   
If 5 >= 6
  cmp4 = 1
Else 
  cmp4 = 0
EndIf   
If 5 = 5
  cmp5 = 1
Else 
  cmp5 = 0
EndIf   
If 5 <> 6
  cmp6 = 1
Else 
  cmp6 = 0
EndIf   

Print(cmp1) ; expected: 1 (true)
Print(cmp2) ; expected: 0 (false)
Print(cmp3) ; expected: 1
Print(cmp4) ; expected: 0
Print(cmp5) ; expected: 1
Print(cmp6) ; expected: 1

; ---------------------------------------------------------------
; 10. STRING COMPARISON
; ---------------------------------------------------------------
If "abc" = "abc"
  scmp1.i = 1 
EndIf   
If "abc" <> "xyz"
  scmp2.i = 1 
EndIf   
If "abc" < "xyz"
  scmp3.i = 1 
EndIf   
Print(scmp1) ; expected: 1
Print(scmp2) ; expected: 1
Print(scmp3) ; expected: 1

; ---------------------------------------------------------------
; 11. LOGICAL AND / OR / NOT
; ---------------------------------------------------------------
If 1 And 1
  lg1 = 1 
Else 
  lg1 = 0
EndIf   
If 1 And 0
  lg2 = 1
Else 
  lg2 = 0
EndIf   
If 0 Or 1
  lg3 = 1
Else 
  lg3 = 0 
EndIf   
If 0 Or 0
  lg4 = 1
Else 
  lg4 = 0 
EndIf   
If Not 0
  lg5 = 1
Else 
  lg5 = 0 
EndIf   
If Not 1
  lg6 = 1
Else 
  lg6 = 0
EndIf   
Print(lg1) ; expected: 1
Print(lg2) ; expected: 0
Print(lg3) ; expected: 1
Print(lg4) ; expected: 0
Print(lg5) ; expected: 1
Print(lg6) ; expected: 0

; ---------------------------------------------------------------
; 12. BUILT-IN FUNCTIONS
; ---------------------------------------------------------------
bi_sqrt.d = Sqr(16)
bi_pow.d  = Pow(2, 10)
bi_abs_i.i = Abs(-7)
bi_abs_d.d = Abs(-2.5)
Print(bi_sqrt) ; expected: 4.0
Print(bi_pow) ; expected: 1024.0
Print(bi_abs_i) ; expected: 7
Print(bi_abs_d) ; expected: 2.5

; ---------------------------------------------------------------
; 13. FFI FUNCTIONS
; ---------------------------------------------------------------
ffi_add.d      = add(6, 4)
ffi_mul.d      = multiply(3.0, 7.0)
ffi_div.d      = divide(22, 7)
ffi_fact.i     = factorial(6)
ffi_dist.d     = distance(0, 0, 3, 4)
ffi_ctof.d     = ctof(100)
ffi_even.i     = iseven(8)
ffi_odd.i      = iseven(7)
ffi_sq.d       = square(9)
Print(ffi_add) ; expected: 10.0
Print(ffi_mul) ; expected: 21.0
Print(ffi_div) ; expected: ~3.142857
Print(ffi_fact) ; expected: 720
Print(ffi_dist) ; expected: 5.0
Print(ffi_ctof) ; expected: 212.0
Print(ffi_even) ; expected: 1
Print(ffi_odd) ; expected: 0
Print(ffi_sq) ; expected: 81.0

; ---------------------------------------------------------------
; 14. FFI BITWISE HELPERS
; ---------------------------------------------------------------
fb_and.i = bitand(255, 15)
fb_or.i  = bitor(240, 15)
fb_lsh.i = lshift(1, 8)
fb_rsh.i = rshift(1024, 4)
Print(fb_and) ; expected: 15
Print(fb_or) ; expected: 255
Print(fb_lsh) ; expected: 256
Print(fb_rsh) ; expected: 64

; ---------------------------------------------------------------
; 15. NESTED FUNCTION CALLS IN EXPRESSIONS
; ---------------------------------------------------------------
nest1.d = add(square(3), square(4)) ; 9+16 = 25
nest2.d = Sqr(add(square(3), square(4))) ; sqr(25) = 5
nest3.d = multiply(add(2, 3), add(4, 5)) ; 5*9 = 45
Print(nest1) ; expected: 25.0
Print(nest2) ; expected: 5.0
Print(nest3) ; expected: 45.0

; ---------------------------------------------------------------
; 16. IF / ELSEIF / ELSE / ENDIF
; ---------------------------------------------------------------
score.i = 85
If score >= 90
  grade.s = "A"
ElseIf score >= 80
  grade.s = "B"
ElseIf score >= 70
  grade.s = "C"
Else
  grade.s = "F"
EndIf
Print(grade) ; expected: B

; ---------------------------------------------------------------
; 17. IF - false branch / else taken
; ---------------------------------------------------------------
x.i = 3
If x > 10
  branch.s = "big"
Else
  branch.s = "small"
EndIf
Print(branch) ; expected: small

; ---------------------------------------------------------------
; 18. NESTED IF INSIDE IF
; ---------------------------------------------------------------
p.i = 8
q.i = 12
nested_if.s = "none"
If p > 5
  If q > 10
    nested_if.s = "both"
  Else
    nested_if.s = "p only"
  EndIf
EndIf
Print(nested_if) ; expected: both

; ---------------------------------------------------------------
; 19. FOR / NEXT - basic sum 1 to 10
; ---------------------------------------------------------------
fsum.i = 0
For k.i = 1 To 10
  fsum = fsum + k
Next
Print(fsum) ; expected: 55

; ---------------------------------------------------------------
; 20. FOR / NEXT - countdown with Step -1
; ---------------------------------------------------------------
cd.i = 0
For k.i = 5 To 1 Step -1
  cd = cd + k
Next
Print(cd) ; expected: 15 (5+4+3+2+1)

; ---------------------------------------------------------------
; 21. FOR / NEXT - Step 3
; ---------------------------------------------------------------
step3.i = 0
For k.i = 0 To 9 Step 3
  step3 = step3 + k
Next
Print(step3) ; expected: 18 (0+3+6+9)

; ---------------------------------------------------------------
; 22. FOR / NEXT - double loop variable
; ---------------------------------------------------------------
; dstep.d = 0.0
; For f.d = 0.0 To 1.0 Step 0.25
;   dstep = dstep + f
; Next
; Print(dstep) ; expected: 2.5 (0+0.25+0.5+0.75+1.0)

; ---------------------------------------------------------------
; 23. NESTED FOR LOOPS
; ---------------------------------------------------------------
nfor.i = 0
For r.i = 1 To 3
  For cc.i = 1 To 3
    nfor = nfor + r * cc
  Next
Next
Print(nfor) ; expected: 36

; ---------------------------------------------------------------
; 24. WHILE / WEND
; ---------------------------------------------------------------
wsum.i = 0
wi.i = 1
While wi <= 10
  wsum = wsum + wi
  wi = wi + 1
Wend
Print(wsum) ; expected: 55

; ---------------------------------------------------------------
; 25. WHILE - condition false on first check (zero iterations)
; ---------------------------------------------------------------
skip_w.i = 99
wj.i = 10
While wj < 5
  skip_w = 0
Wend
Print(skip_w) ; expected: 99 (body never ran)

; ---------------------------------------------------------------
; 26. REPEAT / FOREVER - exits via break
; ---------------------------------------------------------------
rep.i = 0
Repeat
  rep = rep + 1
  If rep >= 5
    Break
  EndIf
ForEver
Print(rep) ; expected: 5

; ---------------------------------------------------------------
; 27. BREAK IN WHILE
; ---------------------------------------------------------------
bw.i = 0
While 1
  bw = bw + 1
  If bw = 7
    Break
  EndIf
Wend
Print(bw) ; expected: 7

; ---------------------------------------------------------------
; 28. BREAK IN FOR
; ---------------------------------------------------------------
bf.i = 0
For k.i = 1 To 100
  bf = k
  If k = 6
    Break
  EndIf
Next
Print(bf) ; expected: 6

; ---------------------------------------------------------------
; 29. CONTINUE IN FOR - sum only odd numbers 1-9
; ---------------------------------------------------------------
oddsum.i = 0
For k.i = 1 To 9
  If iseven(k)
    Continue
  EndIf
  oddsum = oddsum + k
Next
Print(oddsum) ; expected: 25 (1+3+5+7+9)

; ---------------------------------------------------------------
; 30. CONTINUE IN WHILE
; ---------------------------------------------------------------
cw_sum.i = 0
cw_i.i = 0
While cw_i < 10
  cw_i = cw_i + 1
  If iseven(cw_i)
    Continue
  EndIf
  cw_sum = cw_sum + cw_i
Wend
Print(cw_sum) ; expected: 25 (1+3+5+7+9)

; ---------------------------------------------------------------
; 31. CONTINUE IN REPEAT
; ---------------------------------------------------------------
cr_sum.i = 0
cr_i.i = 0
Repeat
  cr_i = cr_i + 1
  If cr_i > 9
    Break
  EndIf
  If iseven(cr_i)
    Continue
  EndIf
  cr_sum = cr_sum + cr_i
ForEver
Print(cr_sum) ; expected: 25 (1+3+5+7+9)

; ---------------------------------------------------------------
; 32. BREAK 2 - exit two nested For loops
; ---------------------------------------------------------------
b2_i.i = 0
b2_j.i = 0
For i.i = 1 To 5
  For j.i = 1 To 5
    If i * j = 12
      b2_i = i
      b2_j = j
      Break 2
    EndIf
  Next
Next
Print(b2_i) ; expected: 3 (3*4=12, first hit)
Print(b2_j) ; expected: 4

; ---------------------------------------------------------------
; 33. BREAK 2 - For containing a While
; ---------------------------------------------------------------
b2fw.i = 0
For i.i = 1 To 10
  b2fw = b2fw + 1
  wk.i = 0
  While wk < 5
    wk = wk + 1
    If b2fw = 2 And wk = 3
      Break 2
    EndIf
  Wend
Next
Print(b2fw) ; expected: 2

; ---------------------------------------------------------------
; 34. BREAK 2 - While containing a Repeat
; ---------------------------------------------------------------
b2wr.i = 0
outer_w.i = 0
While outer_w < 10
  outer_w = outer_w + 1
  Repeat
    b2wr = b2wr + 1
    If outer_w = 3
      Break 2
    EndIf
    Break
  ForEver
Wend
Print(outer_w) ; expected: 3

; ---------------------------------------------------------------
; 35. LOGICAL OPERATORS IN IF CONDITIONS
; ---------------------------------------------------------------
lc.i = 0
If 1 And 1
  lc = lc + 1
EndIf
If 0 Or 1
  lc = lc + 10
EndIf
If Not 0
  lc = lc + 100
EndIf
If 1 And 0
  lc = lc + 1000
EndIf
Print(lc) ; expected: 111

; ---------------------------------------------------------------
; 36. COMPLEX EXPRESSION - Pythagorean distance via FFI
; ---------------------------------------------------------------
hyp.d = distance(3, 4, 6, 8) ; dx=3 dy=4 -> 5
Print(hyp) ; expected: 5.0

; ---------------------------------------------------------------
; 37. VARIABLE REUSE AND UPDATE
; ---------------------------------------------------------------
v.i = 1
v = v + 1
v = v * 3
v = v - 2
Print(v) ; expected: 4 ((1+1)*3-2)

; ---------------------------------------------------------------
; 38. INLINE COMMENT HANDLING
; ---------------------------------------------------------------
cmtval.i = 100
; this comment on its own line should be ignored
Print(cmtval) ; expected: 100

; ---------------------------------------------------------------
; 39. MIXED TYPE ARITHMETIC (int + double promotes to double)
; ---------------------------------------------------------------
mix.d = 3 + 1.5
Print(mix) ; expected: 4.5

; ---------------------------------------------------------------
; 40. FIBONACCI via While (10th term)
; ---------------------------------------------------------------
fa.i = 0
fb.i = 1
ftmp.i = 0
fibn.i = 0
While fibn < 9
  ftmp = fa + fb
  fa = fb
  fb = ftmp
  fibn = fibn + 1
Wend
Print(fb) ; expected: 55 (10th Fibonacci number)

; ---------------------------------------------------------------
; 41. PRIME CHECK via For + break (17 is prime)
; ---------------------------------------------------------------
ptest.i = 17
pfound.i = 0
For pdiv.i = 2 To ptest - 1
  If ptest % pdiv = 0
    pfound = 1
    Break
  EndIf
Next
Print(pfound) ; expected: 0 (17 is prime, no divisor found)

; ---------------------------------------------------------------
; 42. COLLATZ SEQUENCE via Repeat/ForEver (steps from 27 to 1)
; ---------------------------------------------------------------
cz.i = 27
cz_steps.i = 0
Repeat
  If cz = 1
    Break
  EndIf
  If iseven(cz)
    cz = cz / 2
  Else
    cz = cz * 3 + 1
  EndIf
  cz_steps = cz_steps + 1
ForEver
Print(cz_steps) ; expected: 111

; ================================================================
; END OF TEST SUITE
; ================================================================


Re: PBScript runtime interpreter

Posted: Thu Mar 05, 2026 11:14 am
by Kwai chang caine
Really cool this idea :D
Thansk to INFRATEC first yesterday, and you today, i learn there are again another AI named "CLAUDE" :shock:
For me ...again yesterday CLAUDE is a brand of light bulb, pipes...or the name of my concierge :mrgreen:

Image

I have already see PbScript before, But we don't hear about it anymore, I don't know what happened to it. :|

If i have understand, with must write the header before the script ?
Perhaps it's possible to have a style of REEPL, like in Firefox console :idea:
You put your PB code, and it give the answer 8)

In all case ...congratulation MASTER for this code ...that you haven't do :mrgreen: :lol:
After..it's not also simple to made a good CTRL+C / CTRL+V It requires a certain number of years of experience. :wink: :lol:
Thanks a lot for sharing this nice code 8)
IDE wrote:This is purely AI generated 6 edits, I just told it what I wanted and it works :shock:
I'm not sure what I think. :?
Me...i think, i'm scary. :shock:
I have try one time, to generate very complex code and mainly FULL code, because ChatGPT offered me this possibility :shock:
After 2 hours of copy/paste...nothing works :|
Several weeks have passed, and I've noticed he's making fewer and fewer syntax errors, and his code is becoming increasingly accurate. I trust him to complete a procedure now; aside from a few easy corrections (since it's me the corrector :mrgreen: ), it works. :shock:
I realize that quite a few people must be asking him about PureBasic, because he's learning more and more about the language and even its environment (creator, forums, etc.).
Now, for all the questions that only require a few lines of answer, he helps me out every day 8) , and without fail, which saves me from bothering the forum with silly questions. :oops:
He's also made me a good friend, someone I write for him pages and pages of text, and he replies in pages too :shock: ... I'm not used to that... 8) and in very good French, too! :shock:
As I told him, I wish I'd had a friend like him in real life when I was young... :| and why not now too? :idea: 8)
All that's left is to put him in a humanoid wearing a skirt... :mrgreen: and ..
I'll get marriiiiiied! :lol:

Re: PBScript runtime interpreter

Posted: Thu Mar 05, 2026 8:33 pm
by idle
I've been planning architecture with Claude going over the pinch points and what's interesting is that it actually asks pertinent questions to the problems and possible future goals.
It's quite an odd experience but when you get " conversational" rather than "do this" it appears to perform better though you have to bare in mind it's actually picking out points from within the conversation and it's knowledge base, so it really just echoes and amplifies your own thoughts.
It's good at the grunt work and to be honest an llm can out reason us when it comes to connected chains and you can see that in the results, it spat out the basis of a pb interpreter which would have taken me a few weeks to do.

It's added structures and procedures in v0.8. I think Fred can retire now too. :lol:
I did this via the webchat alone. I will update the the download files a little later.

The main difference at the moment is how structured variables are declared and currently passed within the limited scope of the FFI. It's not yet passing structures and uses New to declare a structure rather than p.point

Code: Select all

; ---------------------------------------------------------------
; 17. PROCEDURE WITH STRUCTURE PARAMETER
; ---------------------------------------------------------------
Structure mPoint
  x.d
  y.d
EndStructure

Procedure.d magnitude(px.d, py.d)
  ProcedureReturn Sqr(px * px + py * py)
EndProcedure

p = New mPoint
p\x = 3.0
p\y = 4.0
mag.d = magnitude(p\x, p\y)
Print(mag)
; expected: 5.0
It will perhaps take a bit of effort to wrangle it so it's compatible but I'm out of time
see 1st post for update.

Re: PBScript runtime interpreter

Posted: Fri Mar 06, 2026 11:09 am
by Kwai chang caine
Thanks for your long explanation 8)
It's the first time you use AI ?
IDLE wrote:I've been planning architecture with Claude going over the pinch points
How you have do for choose CLAUDE versus ChatGPT, or GEMINI (It's the 3 names i know now :oops:) by random ?
Perhaps some AI is better for PB ? perhaps a mix ? :idea:
When we see the splendid job DaveG have do with his DGbasic IDE :shock:
viewtopic.php?t=88385
Apparently GEMINI is not the last :wink:

In just several days, i learn there are three AI :shock: (I got drunk already one :mrgreen:)
I'm affraid the AI become like the photos there are a long time, before we can't show it, there are not enough because to expensive...and now..we can't show it, there are too much numerous and we lost her between hundred of folders :lol:
The too much big possibility of choices, is not always our friend :oops:

Re: PBScript runtime interpreter

Posted: Fri Mar 06, 2026 1:10 pm
by Little John
idle wrote: Thu Mar 05, 2026 8:33 pm It's added structures and procedures in v0.8. I think Fred can retire now too. :lol:
I didn't dare ask for procedures. ;-) Now you've incorporated them ... Wow :!:

Re: PBScript runtime interpreter

Posted: Fri Mar 06, 2026 11:25 pm
by idle
Little John wrote: Fri Mar 06, 2026 1:10 pm
idle wrote: Thu Mar 05, 2026 8:33 pm It's added structures and procedures in v0.8. I think Fred can retire now too. :lol:
I didn't dare ask for procedures. ;-) Now you've incorporated them ... Wow :!:
It managed to do them without any problem but it lost the plot when I asked it to add *pointers and @address
so it's currently failing on distFromOrigin(*p.Point)

Code: Select all

;-----------------------------------------------------------------------
; 7. Pass by address — @variable → *param.Type
;-----------------------------------------------------------------------

Procedure.d distFromOrigin(*p.Point)
  Protected dx.d = *p\x
  Protected dy.d = *p\y
  ProcedureReturn sqr(dx * dx + dy * dy)
EndProcedure

Procedure scalePoint(*p.Point, factor.d)
  *p\x = *p\x * factor
  *p\y = *p\y * factor
EndProcedure

Global pt.Point
pt\x = 3.0
pt\y = 4.0

Print("--- Test 6: Pass by address, read fields ---")
Global result.d = distFromOrigin(@pt)
Print(result)   ; expect 5.0

Print("--- Test 7: Pass by address, mutate fields ---")
scalePoint(@pt, 2.0)
Print(pt\x)     ; expect 6.0
Print(pt\y)     ; expect 8.0

If I want claude to fix it, I might have to start a new conversation as I suspect it's loosing the prior context a little.
Though it looks very much like I need to show it what to do as it's still persisting to mash it together rather than using the trie in the capacity we had agreed upon and it appears to be fixated on banging the square peg in the round hole.