• Welcome to Jose's Read Only Forum 2023.
 

Is Charles Pegge ok?

Started by Karen Zibowski, July 05, 2020, 08:35:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Charles Pegge

I've put in a few limits to prevent runaway expansion. You know something is wrong when your memory usage goes over 500megabytes!

The nesting depth for expressions is currently 100 but there is no restriction on macro nesting depth.

Theo Gottwald

#61
So in Expressions you can open 100 (..) brackets?
Thats ok, for now.

So lets see whats your next step, before i ask you for Optimizations for Deep Learning :-).

Charles Pegge


I should clarify that the general nesting stack is limited to a depth of 100, but floating point math is limited to a stack depth of 7. This is because it uses the 8 FPU stacking registers. In practice, this is plenty.

When humans are doing the Basic, a block nesting depth of 20 might be considered extreme, but who knows what structures AI might produce :)

Nicola_Piano

Hi Charles,
could you please give me information regarding these commands and others if there are any?
I would like to put them in the Help file.


Pseudo commands similar to PowerBasic
chr(s,i)= character
wchr(s,i)= wide character
asc(s,i)= byte
unic(s,i)= word

and secondary keywords in the metalanguage:
#if leftmatch symbol, string
#if rightmatch symbol, string
#if anymatch sybol string

Charles Pegge

#64
My initial manual entries:

from inf/o2keyw.dat
key:      "asc 16"
action:   returns ascii encoding of a character in a string
use:      AsciiCode=asc(String,CharacterPosition)
example: 
  'as function:
  a=asc("ABCDEF",2) 'a=66 'B'
  'as pseudo-command:
  asc(s,2)=98 's="AbCDEF"
related:  unic, chr, mid, val, len, str
group:    string functions
updated:  16/06/2022
.

key:      "unic 16"
action:   returns encoding of a character in a wide string
use:      uni=unic(String,CharacterPosition)
example:  a=unic(L"ABCDEF",2)
result:   a=0x0042 'character='B'
related:  asc, wchr, chr, val, mid, len, str
remarks:  Can also be used as a pseudo-command like asc()
group:    string functions
updated:  16/06/2022
.

key:      "chr 16"
action:   returns string of 1 character of ascii encoding (0..255)
use:      string=chr(AsciiValue)
example: 
  'as function:
  s=chr(65) 's="A"
  'as pseudo-command:
  string s="abcdef"
  chr(s,2)="B" 's="aBcdef"
related:  wchr, asc, unic, mid string
group:    string functions
updated:  16/06/2022
.

key:      "wchr 16"
action:   returns wide string of a 2 byte character (encoding 0..65535 / 0xffff)
use:      widestring=wchr(WideCharValue)
example:  wstring ws=wchr(65)
result:   ws contains unicode character 0x0041
remarks:  Can also be used as a pseudo-command like chr()
related:  unic, asc, mid, string
group:    string functions
updated:  16/06/2022
.

key:      "defined 57"
key:      "undefined 57"
key:      "match 57"
key:      "leftmatch 57"
key:      "rightmatch 57"
key:      "anymatch 57"
title:    meta keywords
action:   match teting of symbol names
use:      to allow blocks of code to be included or omitted at compile time
example: 
  #if leftmatch X, "vector"
    #include "mathutil.inc"
  #endif
related:  #if, #elseif, #else, #endif, typeof, typecodeof, def, macro
remarks:  generally for use inside macros
groupref: metakeywords
group:    meta control
updated:  17/06/2022
.


Nicola_Piano

Well Charles!
... even if, given my ignorance also of the English language, I like to have more explanations and more examples ...
Even the ".inc" files have few explanatory notes ... and it is difficult to understand how the implemented functions work ... and it is not easy to distinguish between internal functions and external, ie final, functions to be used in your programs.
Ciao