A new spring, a new language, the raspberry pico and lucky7.

114 views
Skip to first unread message

none albert

unread,
Mar 7, 2021, 9:45:03 AMMar 7
to
In developing a Forth for the Raspberry Pico I was wondering how
welcoming that community would be to Forth intricacies.

So here is the one page definition of lucky 7 a languages that might
address that. It is actually Forth without the weird terminology.
Notable missing is the stack.
A "recipe" "finds" one or two "things" to work on.
Instead of the like of "a noname definition is a word that has no name"
(Huh?).
Yes locals are in there, build/does is in there.
\--------------------------------------------------

The basic construct of the language is the recipe.
{ A B C } leaves a thing that when RUN performs A B C in sequence.
Such a recipe can be given a name by :
{ A B C } : MYRECIPE
MYRECIPE becomes a new command that runs the recipe and
can be used in new recipe's.
{ A B } : C { C D C } : Q
Note that a recipe can leave things that are used by other ones.
We say that MYRECIPE is a new definition that is added to the glossary.
'MYRECIPE gets the recipe itself back.
{ 7 } : LUCKY
is the way to define constants.
By adding a | , recipes can be used to do loops and conditional
actions. They then run directly and do not leave a recipe,
but rather the things that result from performing the instructions.
| checks a thing and leaves true/false, whether the thing is zero.
{ A | B } performs A , then if | finds false it terminates,
otherwise it does B and starts over again at A.
{ A }|{ B } | checks a thing, if it finds true it performs A else B.
{ A }|{ } can be abbreviated to { A }|

lucky7 has build in actions on one or two things that are
interpreted as either a signed number or a bitmask.
A truth value (logical) is a bitmask with all bits the same.
A number can identify a byte in computer memory,
then it is called an address.
Signed number pairs (including addresses):
+ - * / arithmetic result
< <= > >= logic result
bitmasks:
OR AND XOR << >> bitmask result
The following actions work on a single thing.
Signed number:
NEGATE arithmetic result
Bit-mask
INVERT bitmask
Pair of whatever things.
= <> logic result

Comparing, subtracting of addresses are meaningful; negative
addresses are not allowed.

The next level, the word META and nested compilation.
{ A } { B } META DEFINER
DEFINED X adds a word X to the glossary. It remembers the
position of HERE and then performs A. Then if later X is
to run, it finds that position of HERE and performs B.
A predefined META word is DATA
{ } { } META DATA

Building a recipe between { and } is called compilation.
A compilation can be interrupted by a matched pair [ ].
Any code can be run between the square brackets, in particular
adding definitions to the glossary. However those definitions
only are visible until the } of the enclosing recipe.
A [ ] pair shall leave nor consume things.

Loops, the word DO.
7 { A B C } DO performs the recipe 7 times.
IX will give the loop counter, starting from 0.

Expressions like 1234 leave a thing that is a signed number.
Expressions like "1234" leaves two things, an address and a count.

\--------------------------------------------------

It is my belief that one could do interesting things with the
Pico using lucky7.

Notes for the Forthers

Notably missing:
AGAIN UNTIL AHEAD CREATE DOES> :NONAME [:

<< >> are contrary to 2* 2/ a logical shift.

No double precision shit, no local shit.

Not really missing, may lay under the hood:
USER <os calls> PREFIX IMMEDIATE PAD

Any advanced wordlist:
<# and friends,
WORDLIST and friends
CLASS and friends
ASSEMBLER
floating point.
Development stuff: .S WORDS SEE LOCATE REGRESS T{ DEBUG

Maybe I'll keep it a secret for the unwashed masses that it is
based on Forth.

Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Marcel Hendrix

unread,
Mar 7, 2021, 12:04:15 PMMar 7
to
On Sunday, March 7, 2021 at 3:45:03 PM UTC+1, none albert wrote:
> In developing a Forth for the Raspberry Pico I was wondering how
> welcoming that community would be to Forth intricacies.
[..]
> The basic construct of the language is the recipe.

> We say that MYRECIPE is a new definition that is added to the glossary.

I suggest "cookbook".

Or "cookbook for dummies" :--)

-marcel

Rod Pemberton

unread,
Mar 7, 2021, 2:18:28 PMMar 7
to
On 07 Mar 2021 14:33:53 GMT
albert@cherry.(none) (albert) wrote:

> In developing a Forth for the Raspberry Pico I was wondering how
> welcoming that community would be to Forth intricacies.
>
> So here is the one page definition of lucky 7 a languages that might
> address that. It is actually Forth without the weird terminology.
> Notable missing is the stack.
> A "recipe" "finds" one or two "things" to work on.
> Instead of the like of "a noname definition is a word that has no
> name" (Huh?).
> Yes locals are in there, build/does is in there.
> \--------------------------------------------------
>
> The basic construct of the language is the recipe.
> { A B C } leaves a thing that when RUN performs A B C in sequence.
> Such a recipe can be given a name by :
> { A B C } : MYRECIPE

So, it's an object-oriented language, i.e., "actions" : "object" in the
form of DO-STEPS : MYRECIPE .

I'm guy. So, recipes aren't my thing. I like cats and dogs though,
and dogs are trainable. How about an "actions" : "object" in the form
of GO-FETCH : MYDOG ?

--
Diplomacy with dictators simply doesn't work.

Bernd Linsel

unread,
Mar 7, 2021, 2:51:34 PMMar 7
to
Reminds a bit of an incomplete PostScript...

none albert

unread,
Mar 27, 2021, 5:55:02 AMMar 27
to
In article <s238u0$12jb$1...@gioia.aioe.org>,
In your metafoor the computer is the dog, and he can RUN commands
like GO-FETCH LOUD DEAD ROLL SIT STAY LOOSE

{ 100 { SIT STAY GO-FETCH LOOSE } DO } : A-DOGS-DAY

Recipes suggest you run them yourself as in
{ EGG BREAK ... CLUDGE ... BAKE } : PIE
So your metafoor is better.

GO-FETCH suggest that a different entity than yourself, capable of
intentional behaviour (a human, animal, chess program, a god) is
commanded to do something, hence the personal "he".
Reply all
Reply to author
Forward
0 new messages