The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Topics that can go away
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

I have decided to write a Forthy dynamically-typed scripting language on top of zeptoforth, which I have dubbed zeptoscript. What little I have tested so far seems to be working... with the big exception of that half the time the GC is borked (and half the time it works perfectly)...
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

And now the GC works, and it is already quite functional (e.g. I can do things like declare and use data structures, manipulate strings on the heap, create and execute closures, and like).
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
bradrn
Posts: 5502
Joined: Fri Oct 19, 2018 1:25 am

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by bradrn »

For all Linux users here: a severe vulnerability has been found in xz, seemingly giving a backdoor into SSH servers. The recommendation is to upgrade as soon as possible.
Conlangs: Scratchpad | Texts | antilanguage
Software: See http://bradrn.com/projects.html
Other: Ergativity for Novices

(Why does phpBB not let me add >5 links here?)
Ares Land
Posts: 2717
Joined: Sun Jul 08, 2018 12:35 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Ares Land »

bradrn wrote: Sat Mar 30, 2024 5:53 am For all Linux users here: a severe vulnerability has been found in xz, seemingly giving a backdoor into SSH servers. The recommendation is to upgrade as soon as possible.
Damn. This is going to be a long week at work.
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

zeptoscript is coming along well, and is really fun to play with and add features to; now you can do things like

Code: Select all

s" baz" 2 >pair s" bar" 1 >pair s" foo" 0 >pair >triple [: { x y } 1 x @+ 1 y @+ < ;] sort [: 0 swap @+ ;] map s" ***" join type
which gives:

Code: Select all

foo***bar***baz ok
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

I just realized how to implement object-orientation in zeptoscript how I would like to implement it. There would be no superclasses or subclasses, just classes implementing methods instantiated into objects, which are declared independent of any class. For the sake of simplicity there would be no metaclasses. Code for it would look something like:

Code: Select all

\ Declare our methods
method foo ( self -- )
method bar ( qux quux self -- )
method baz ( self -- qux quux )

\ Declare class foobar
begin-class foobar

  \ Declare our members
  member: foobar-qux
  member: foobar-quux
  
  \ Declare our constructor
  :method new { qux quux self -- }
    qux self foobar-qux!
    quux self foobar-quux!
  ;
  
  \ Declare our other methods
  
  :method foo { self -- }
    ." FOO "
  ;
  
  :method bar { qux quux self -- }
    ." BAR "
    qux self foobar-qux!
    quux self foobar-quux!
  ;
  
  :method baz { self -- qux quux }
    ." BAZ "
    self foobar-qux@
    self foobar-quux@
  ;
  
end-class
Each object would consist behinds the scene as a cell sequence whose first element would point to its class and its subsequent elements would point to the class's elements. In turn, its class would be internally a byte sequence (so its contents are ignored by the garbage collector) organized into pairs of cells where the first cell in each pair is a method key (where 0 indicates that that entry is empty) and the second cell in each pair points to the code implemeting said method.

For compilation into flash, how it would work is that each implemented method would be placed (except for the method code itself) in a linked list in RAM (which is possible due to the freedom provided by zeptoscript w.r.t. memory management; I could not have easily done this with zeptoforth, hence the design of zeptoforth's OO layer), and would only be written out to flash once implementing all the methods is complete.

Also, each method would be given a global ID, which would be a positive integer for methods specified in flash and a negative integer for methods specified in RAM. The method table for each class would be a hash table with integral keys using these ID's which would contain a power-of-two entries (this is important because it avoids the need for a modulus when looking up methods).
Last edited by Travis B. on Wed Apr 10, 2024 1:46 pm, edited 1 time in total.
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
User avatar
malloc
Posts: 461
Joined: Mon Jul 09, 2018 8:42 pm
Location: The Vendée of America

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by malloc »

For some reason, I cannot get into irc.sorcery.net. It keeps saying "Unknown host. Maybe you misspelled it?" even though it's the same host I've always used.
Mureta ikan topaasenni.
Koomát terratomít juneeratu!
Anti-TESCREAL Action | He/him
User avatar
alice
Posts: 884
Joined: Mon Jul 09, 2018 11:15 am
Location: 'twixt Survival and Guilt

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by alice »

malloc wrote: Mon Apr 08, 2024 8:58 pm For some reason, I cannot get into irc.sorcery.net. It keeps saying "Unknown host. Maybe you misspelled it?" even though it's the same host I've always used.
Maybe the site is down?
I can no longer come up with decent signatures.
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

Okay, OO in zeptoscript is working and is nice to use; I have always been a fan of the idea of disconnecting methods from any kind of class hierarchy -- zeptoscript OO has no inheritance, BTW -- and I have accomplished that with zeptoscript OO. I had wanted to do this with zeptoforth OO, but the limitations of the zeptoforth memory management model rendered this practically impossible, hence why I opted for a single-inheritance, methods-belonging-to-classes model for it. (However, zeptoscript class members, not methods, are specifically tied to their classes, and raise exceptions if you try to use them on any other classes.)
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

alice wrote: Tue Apr 09, 2024 2:35 pm
malloc wrote: Mon Apr 08, 2024 8:58 pm For some reason, I cannot get into irc.sorcery.net. It keeps saying "Unknown host. Maybe you misspelled it?" even though it's the same host I've always used.
Maybe the site is down?
I tried pinging irc.sorcery.net today and had no problem.
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

Some zeptoscript updates:
  • I have written a basic guide to programming in zeptoscript. Note that it assumes at least a basic level of knowledge of programming in Forth.
  • I have added the capability to have "type" classes (not to be confused with Haskell type classes) to enable the creation of methods such as show, hash, and equal? (which I will mention later) that can be called on anything.
  • I have added a pair of convenience words, #[ and ]# for constructing lists, e.g. #[ 1 2 4 8 16 32 64 128 256 ]# ' . iter-list outputs 1 2 4 8 16 32 64 128 256 ok.
  • I have updated my show, hash, and equal? methods in zeptoscript so they can hand larger lists without exploding the stack (by testing their arguments for whether they are valid lists non-recursively, and if they are iterating over them rather than recursively descending into them, e.g. #[ 1 2 4 8 16 32 64 128 256 ]# show type outputs #[ 1 2 4 8 16 32 64 128 256 ]# ok.
  • I have added code for compiling non-string literal constant byte strings, e.g. begin-const-bytes foo $80 c, $81 c, $82 c, $83 c, end-const-bytes foo ' . iter outputs 128 129 130 131 ok.
  • I have added "collect" words for generating cell sequences, byte sequences, and lists, e.g. 0 16 [: dup 1+ swap ;] collectl-cells ' . iter outputs 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ok.
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
User avatar
alice
Posts: 884
Joined: Mon Jul 09, 2018 11:15 am
Location: 'twixt Survival and Guilt

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by alice »

Cool stuff, travis. How does doing all this in a Forth-style environment differ from, say, a more tradtional C-style one, besides the obvious? Is it easier or harder? Etc.
I can no longer come up with decent signatures.
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

alice wrote: Sun Apr 28, 2024 2:22 pm Cool stuff, travis. How does doing all this in a Forth-style environment differ from, say, a more tradtional C-style one, besides the obvious? Is it easier or harder? Etc.
It is easier, because I have much closer control over the whole execution and compiling environments, and I can effectively replace the underlying Forth environment, yet at the same time I can readily interface with the underlying Forth environment as I see fit (i.e. "foreign" words). Were I to do this in a traditional C-style environment, I would have to write a new compiler and runtime from scratch, and interfacing with C code from within the inner environment would be much more difficult.
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

I have implemented continuations (think call/cc in Scheme, or in this case, in zeptoscript) and have implemented cooperative multitasking and inter-task channels with them. (Note that zeptoforth, which zeptoscript is on top of, has preemptive multitasking but zeptoscript itself cannot run on multiple zeptoforth tasks for reasons.)
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
User avatar
Raphael
Posts: 4043
Joined: Sun Jul 22, 2018 6:36 am

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Raphael »

I don't really know enough about programming to follow this, but - wasn't the original point of zeptoforth to go back to the basics with a bare metal rather than higher level language?
bradrn
Posts: 5502
Joined: Fri Oct 19, 2018 1:25 am

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by bradrn »

Raphael wrote: Tue Apr 30, 2024 3:15 am I don't really know enough about programming to follow this, but - wasn't the original point of zeptoforth to go back to the basics with a bare metal rather than higher level language?
I will admit to having the same query. To me, the attraction of Forths generally is their low-level–ness — I don’t see the point of a ‘scripting Forth’, and once it’s dynamically-typed I’m not sure I’d really consider it a Forth at all.
Conlangs: Scratchpad | Texts | antilanguage
Software: See http://bradrn.com/projects.html
Other: Ergativity for Novices

(Why does phpBB not let me add >5 links here?)
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

bradrn wrote: Tue Apr 30, 2024 5:13 am
Raphael wrote: Tue Apr 30, 2024 3:15 am I don't really know enough about programming to follow this, but - wasn't the original point of zeptoforth to go back to the basics with a bare metal rather than higher level language?
I will admit to having the same query. To me, the attraction of Forths generally is their low-level–ness — I don’t see the point of a ‘scripting Forth’, and once it’s dynamically-typed I’m not sure I’d really consider it a Forth at all.
The point of zeptoforth was to have a compiler and operating system on top of bare metal. The point of zeptoscript is to have something like Scheme implemented on top of that operating system.
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
Travis B.
Posts: 6024
Joined: Sun Jul 15, 2018 8:52 pm

Re: The Computer And General Tech Thread - Software, Hardware, Questions, etc.

Post by Travis B. »

I fixed the major bug I had encountered in zeptoscript, which really had nothing to do with call/cc or multitasker and everything to do with the garbage collector running when execution tokens are created, which had a bug where the top of the stack would be duplicated. Now the multitasker works beautifully now that this bug has been fixed.
Ġëbba nuġmy sik'a läka jälåsåmâxûiri mohhomijekene.
Leka ṙotammy sik'a ġëbbäri mohhomijekëlâṙáisä.
Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa. Q'omysa.
Post Reply