lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 10/1/23 15:19, Родион Горковенко wrote:
Probably you'd better start with examples of "script in natural language".

Natural language is a vague thing and it is difficult to reach a vague
goal. You probably rather aim to parse something which _looks like_
natural language but isn't it.
Yes, you are right.
My goal is not to parse actual natural language as this would require a full ChatGPT system to do that.

The goal is to make it look like it were natural language by smart choice of function and variable names along with inserting comments which fit perfectly in the flow of the used words creating a look of a natural language text which is easy to read and to understand.

The concept includes usage of the additional syntax freedom with appropriate true type font which will indicate existence of special codes, but in a way not disturbing the flow of the text resembling natural language sentences to most possible degree.

Lua is to my knowledge the only language almost there and already useful for the purpose, but constructs like

_='some explanation of what' setting_value_of_variable_x  --[[function does with the final goal of
of adding x to y]]

distract the look of the text flow a bit too much, so I would like to have the option to replace the above with:

'some explanation of what' setting·value·of·variable·x »function does, with the final goal
of adding x to y
«.

replacing in the custom font used to represent the Lua script code `»` and `«` with much less noticeable versions.

Claudio



On Sun, Oct 1, 2023 at 2:42 PM Claudio Grondi <claudio.grondi@freenet.de> wrote:

Lua would require some minor changes only, which if I am not mistaken
won't break any past code and should be relatively easy to implement, in
order to support natural language texts as valid script code.

May someone help me to provide proof of the concept explaining where and
how to modify Lua C-code in order to:

1.    allow ASCII values 0x02 (Start of Text) and 0x03 (End of Text) to
be used in script code and interpreted respectively as `[[` and `]]`

2.    allow function calls by specifying the function name only (without
using braces and without the need of passing a parameter)

3.    extend [_a-zA-z0-9] characters allowed in symbol names with ASCII
value 0x1F (Unit Separator) and `-` which will be treated like [0-9] not
allowed as first symbol name characters

4.    allow usage of unnamed strings (i.e. string literals which can be
specified anywhere in code without the need of assigning them to a
symbol) ignoring them like comments

5.    allow next to `;` also usage of `,` , `.` and `:`

?