@d6 @karolbelina I was trying to find prior art for this with others concatenative languages, if you have seen this in the wild I'd love to read about it!
I was wondering if either of you have the patience/tooling to generate a balance table for each opcode? I need a 256 bytes page where each byte is hb: input, lb: output.
Beetlang is the concept of a programming language for the uxn ecosystem I want to develop. It is going to simplify common uxntal idioms, while still providing access to raw bytes. I want it to be a superset of TAL.
@bouncepaw @d6 @karolbelina it would need to be a binary table made of shorts for each opcode corresponding to the opcode hex value. The high byte would be for RST effect, the low byte for WST effect, and each high nibble input, and each low nibble output.
@d6 so like, each byte is the corresponding opcode, which consists of high nibble and low nibble (0bHHHHLLLL), and each nibble can encode the stack "state", so like 0 is empty stack, 1 is stack with one byte, 2 is stack with one short, 3 is stack with byte and short (or short and byte) and so on?
@bouncepaw @d6 @karolbelina Actually, it would be better if RST was in the low-byte so I can use the flag to increment the position by one.
0xffff
[ WST input nibble ] [ WST output nibble ] [ RST input nibble ] [ RST output nibble ]
@karolbelina @d6 I understand what the values are you want the generate, but what form should this take? a text file file with hex notation so you can include it into any Uxntal program, or a binary file with just the bytes?
@d6 @karolbelina As soon as I woke up this morning I realised that wasn't quite right. Messed up the shifts. Hopefully fixed now. It's now properly sorted as well.
:: If you are looking for prior art in statically checked stack based languages there is Kitten and Cat. Also, Factor implements stack checking for input and output effects to match, but it is dynamically typed. I've been told Joy does stack checking, but I'm not certain.
hah, i noticed that only because i was doodling with an uxntal type checker lately. no code yet, just some ideas on paper (might share those soon)
unfortunately i was stumped by some things regarding the implementation in my head. i'm so happy you're working on that kind of thing, would be a great addition to the ecosystem. love the name too. balancing the stack!
@klardotsh @tty every opcode's stack effect is predictable, so a pure function without branching:
@function ( a* b -- c ) ADD ADD JMP2r
My balancer knows that the stack should be 2 items less then when coming in, I can run through each opcode and get the expected offset, if the balance planned, and the balance actual don't match, then I throw a warning.
Devine Lu Linvega
Unknown parent • • •Devine Lu Linvega
in reply to Devine Lu Linvega • • •Summary of Forth Style Conventions
www.forth.orgDevine Lu Linvega
in reply to Devine Lu Linvega • • •Devine Lu Linvega
Unknown parent • • •Görllewin
Unknown parent • • •Alina Yossimouse
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to Alina Yossimouse • • •Devine Lu Linvega
Unknown parent • • •Karol Belina
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to Karol Belina • • •⛧ esoterik ⛧
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to ⛧ esoterik ⛧ • • •I was wondering if either of you have the patience/tooling to generate a balance table for each opcode? I need a 256 bytes page where each byte is hb: input, lb: output.
bouncepaw 🍄
in reply to Devine Lu Linvega • • •I'm interested because of the Beetlang concept: https://melanocarpa.lesarbr.es/hypha/beetlang
Beetlang
melanocarpa.lesarbr.esDevine Lu Linvega
in reply to bouncepaw 🍄 • • •http://wiki.xxiivv.com/site/uxntal_reference.html
For example:
ADD 0021
ADD2 0042
ADD2k 0046
ADD2r 4200
XXIIVV — uxntal reference
wiki.xxiivv.combouncepaw 🍄
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to Devine Lu Linvega • • •0xffff
[ WST input nibble ] [ WST output nibble ] [ RST input nibble ] [ RST output nibble ]
Karol Belina
in reply to Devine Lu Linvega • • •WimⓂ️
in reply to Karol Belina • • •Devine Lu Linvega
in reply to WimⓂ️ • • •Devine Lu Linvega (@neauoire@merveilles.town)
MerveillesWimⓂ️
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to WimⓂ️ • • •⛧ esoterik ⛧
in reply to Devine Lu Linvega • • •https://github.com/non/uxntal-mode/blob/main/uxntal-mode.el#L225
(it's used to provide an interactive command to show the stack effect for any instruction with any combination of 2kr).
uxntal-mode/uxntal-mode.el at main · non/uxntal-mode
GitHubWimⓂ️
in reply to ⛧ esoterik ⛧ • • •https://codeberg.org/wimvanderbauwhede/nito/src/branch/devel/uxn-ops-type-table-generator.raku
https://codeberg.org/wimvanderbauwhede/nito/src/branch/devel/balance-table.tal
nito
Codeberg.orgDevine Lu Linvega
in reply to WimⓂ️ • • •The numbers are much too high
EOR2 3EA0?
Wouldn't that be just 0042?
WimⓂ️
in reply to Devine Lu Linvega • • •Capital
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to Capital • • •Job
in reply to Devine Lu Linvega • • •I'm pretty sure I saw another typed stack language inspired by both cat and kitten somewhere not too long ago but my bookmarks fail me.
GitHub - cdiggins/cat-language: Cat - a statically typed functional stack-based programming language
GitHubDevine Lu Linvega
in reply to Job • • •Capital
in reply to Devine Lu Linvega • • •Karol Belina
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to Karol Belina • • •Karol Belina
in reply to Devine Lu Linvega • • •uxnbal_tables.txt
GistDevine Lu Linvega
in reply to Karol Belina • • •Devine Lu Linvega
in reply to Devine Lu Linvega • • •Karol Belina
in reply to Devine Lu Linvega • • •hah, i noticed that only because i was doodling with an uxntal type checker lately. no code yet, just some ideas on paper (might share those soon)
unfortunately i was stumped by some things regarding the implementation in my head. i'm so happy you're working on that kind of thing, would be a great addition to the ecosystem. love the name too. balancing the stack!
p1xelHer0
in reply to Devine Lu Linvega • • •poetaster
in reply to Devine Lu Linvega • • •poetaster
in reply to poetaster • • •( S: before "parsed-text-abbreviation" -- after )
2.2.3 https://forth-standard.org/standard/notation#notation:terms
2 Terms, notation, and references
forth-standard.orgDevine Lu Linvega
in reply to poetaster • • •poetaster
in reply to Devine Lu Linvega • • •spooky blip 👻
Unknown parent • • •Devine Lu Linvega
Unknown parent • • •spooky blip 👻
in reply to spooky blip 👻 • • •Devine Lu Linvega
Unknown parent • • •@function ( a* b -- c )
ADD ADD
JMP2r
My balancer knows that the stack should be 2 items less then when coming in, I can run through each opcode and get the expected offset, if the balance planned, and the balance actual don't match, then I throw a warning.
Devine Lu Linvega
Unknown parent • • •Ross Andrews
in reply to Devine Lu Linvega • • •psf
in reply to Devine Lu Linvega • • •