TokenLine flat syntax

  • 1 Replies
  • 1536 Views
*

Zero

  • Eve
  • ***********
  • 1287
TokenLine flat syntax
« on: July 05, 2018, 10:40:00 am »
Hi,

For authoring chatbots, or anything heavily string-based (like interactive fiction), there's a need for a syntax that would ease as much as possible the writing process of programs that contain a lot of constant strings.

If you break down any syntax to its smallest constituents, you find characters. Every language starts with a flat sequence of characters. The meaning of these characters is then defined to express nesting structures ...etc.

Hence the simplest syntax would be to have one token per line. Indentation doesn't even matter, one token per line is enough (just like a sequence of character is enough) to express structures of any complexity-level.


category
pattern
* told me to say *
template
one of
Why would #1 tell you to say "#2"?
Did you say "#2" after #1 told you to?
end one of


Let's try a good'ol naive fib!


function
fib
arg
number
body
return
if
less than
number
3
then
1
else
sum
fib
substract
number
1
end substract
end fib
fib
substract
number
2
end substract
end fib
end sum
end if
end function


Do you like it korrelan?  ;D


Ed: Of course for real usage, indentation makes it readable, if you don't mind applying trim() everywhere.


function
    fib
    arg
        number
    body
        return
            if
                less than
                    number
                    3
            then
                1
            else
                sum
                    fib
                        substract
                            number
                            1
                        end substract
                    end fib
                    fib
                        substract
                            number
                            2
                        end substract
                    end fib
                end sum
            end if
end function


Applied to consnet:


define
    has car
    parameters
        argument model
        argument owner
    body
        let
            a
            new empty cons cell
        end let
        cons cell
            cons cell
                a
                car
            end cell
            is a
        end cell
        cons cell
            cons cell
                a
                argument model
            end cell
            model of car
        end cell
        cons cell
            cons cell
                a
                argument owner
            end cell
            belongs to
        end cell
end define
« Last Edit: July 05, 2018, 12:10:46 pm by Zero »

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: TokenLine flat syntax
« Reply #1 on: July 05, 2018, 12:58:52 pm »
Why not go the extra step and digress right back to assembly code? Lol. ;D

 :)
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

 


OpenAI Speech-to-Speech Reasoning Demo
by ivan.moony (AI News )
March 28, 2024, 01:31:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am
Nvidia Hype
by 8pla.net (AI News )
December 06, 2023, 10:04:52 pm
How will the OpenAI CEO being Fired affect ChatGPT?
by 8pla.net (AI News )
December 06, 2023, 09:54:25 pm
Independent AI sovereignties
by WriterOfMinds (AI News )
November 08, 2023, 04:51:21 am
LLaMA2 Meta's chatbot released
by 8pla.net (AI News )
October 18, 2023, 11:41:21 pm

Users Online

281 Guests, 0 Users

Most Online Today: 363. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles