Nп/п : 12 из 93
 От   : none) (albert                       2:5075/128        21 июн 23 13:42:51
 К    : Spiros Bousbouras                                     21 июн 23 14:48:06
 Тема : Re: Estimate: How man Forth-LOCs (line of code) for 10000 C-LOCs ?
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
35b810ca
@REPLY: <isMgDLLnFWYAwAbcn@bongo-ra.co> e76451b3
@REPLYADDR none) (albert
@REPLYTO 2:5075/128 none) (albert
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:
<2bcb3a48-7082-4d29-9496-829749a5403cn@googlegroups.com> <nzRJAvWCQBiyNSZoM@bongo-ra.co>
<isMgDLLnFWYAwAbcn@bongo-ra.co>
@RFC-Message-ID:

@TZUTC: 0200
@TID: FIDOGATE-5.12-ge4e8b94
In article <isMgDLLnFWYAwAbcn@bongo-ra.co>,
Spiros Bousbouras  <spibou@gmail.com> wrote:
>On Mon, 19 Jun 2023 11:41:44 +0200
>albert@cherry.(none) (albert) wrote:
>> In article <nzRJAvWCQBiyNSZoM@bongo-ra.co>,
>> Spiros Bousbouras  <spibou@gmail.com> wrote:
>> >For 2 or more levels of nesting , I find it a lot more readable
>> >to use explicit calls instead of nested backquotes. With the
>> >explicit calls , you push all the quoting to the innermost level
>> >and otherwise the usual evaluation rules apply. It usually is
>> >more verbose but I find it more readable.
>>
>> I have been experimenting with a reverse polish like language.
>> The main elements are bracket pairs.
>> { } is deferred code
>> { do something } leaves a token that can be "run".
>> Normally code is executed, but you can execute code
>> while in deferred mode by [ ]
>> So you got
>> { [ 1 2 + "addition result:" type . ] "hello world" type }
>> This types the addition result while the line is entered.
>> It leaves a token that can be run to type the "hello world| message.
>> Normally a deferred token is given a name via `:` like so.
>> { "hello world" type } : hellow
>>
>> The idea is that the brackets can be nested indefinitely.
>> { [ variable x ] .... x ... }
>> {
>>     [
>>         variable x
>>         { 2 * + } : add-a-duplicate
>>     ] .... x add-a-duplicate ...
>> } : do-something
>>
>> Is that idea related?
>
>It is related to the overall discussion but it is kind of the opposite to
>what I was saying in my post you are directly replying to. I find it harder
>to read where you have nested scopes and , depending on the level of nesting
>, the evaluation happens during translation time or later and that`s the kind
>of thing I aim to avoid. I find your notation better than backquotes and
>commas but basically with something like  { .... }  , you still have to read
>deeper to see if there are any  [ ... ]  and within a  [ ... ]  deeper to see
>if there are any  { ... } and so forth ; whereas with Common Lisp`s QUOTE ,
>you know right away that everything in the scope of QUOTE will be taken as
>is. Actually this isn`t completely accurate because CL also offers read time
>evaluation but I`ve never used it , I don`t think it`s a good idea and I turn
>it off by setting *READ-EVAL* to NIL .
>
>Apart from that , I find your approach interesting. How far are you planning
>to develop your language ? How high level is it going to be ? For example
>with CL macros , one of the arguments of the macro often is some user
>provided code and the macro produces some code of its own and combines it
>with the user code to achieve a desired effect. The analogous for your
>language would be to pass some user code on the stack. Perhaps the same
>effects can be achieved by passing an execution token on the stack , it
>depends on what else the language can do.

I keep the language as compact and simple as possible.
Most words are familiar Forth words, meta takes the role of the
CREATE/DOES> construct.

This is all:
    { } [ ] : run reserve meta do ix poke peek bpoke bpeek r r- 0x x. $.
    >r r> . drop dup over nip swap pdup pdrop spswap + - * / < > or and
    xor negate invert = <> here , % not << >> >= <= false true data do
    variable |{ }|{ }| {| | |} ; lsn clr shw include from: import want

The idea is to provide the user with a simple scripting language,
in competition with python. Almost nobody  is programming in python,
everything complicated is relegated to c-libraries.
Likewise  classes libraries and such is programmed in the underlying
implementation language Forth and accessed with
    include from: import want


A simple example for a blinking led:

WANT MS #output set-function

{ 24 } : led
#output led set-function
{ led gpio-on 100 MS led gpio-off 100 MS } : blink

You can do "blink" or "blink blink blink"
eternal blinking:   {| blink |}
ten times blinking:   1 10 `blink do

Groetjes Albert
-- 
Don`t praise the day before the evening. One swallow doesn`t make spring.
You must not say "hey" before you have crossed the bridge. Don`t sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning.            - the Wise from Antrim -
--- trn 4.0-test77 (Sep 1, 2010)
 * Origin: KPN B.V. (2:5075/128)
SEEN-BY: 5005/49 5015/255 5019/40 5020/715 848 1042
4441 12000 5030/49 1081
SEEN-BY: 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх