How should I approach making gui creation “language”

Disclaimer, I am not asking for code, I am simply asking for different perspectives on how to approach/execute what I explain later.

Background

For a project of mine, I’m making a sort of “browser”, made up of user generated websites. The problem lies when I need a way to get said websites. I determined that the way I want to approach that is having special “scripts” stored in a data store. This allows for “dynamic” loading websites, automatically. This is also a tad bit easier than having to handle models of gui templates manually.

Hello developers, I have come to request your feedback on how I should approach:

What I am trying to create is a system that generates gui based on a custom script, like html. I want to say its like a custom made language without the advanced stuff, but I don’t know how well that holds up. I need help on a way for the script to be read.

What I’m thinking of doing

What I think

The script uses a “line declaration method” where in theory, you would declare each line by what you would do in said line. For example,

c Hello there —The entire line would be ignored, its a comment
v variable=“Hello There” —V = variable, you’re declaring the said line to be a variable
f new_gui(“TextLabel”).Text(“Hello there”).TextSize(14) —Would execute a function from a pre-defined list, not using load string for obvious reasons, among the tougher things to script, but i’m okay with that

Lets say you have a really long line, but you want it included in the previous lines declaration.
I would not create a new line, but instead adjust the length of the old line, so that it takes up a line, but isn’t considered a new line.

Something that I haven’t really worked out:

v var=new_gui(“TextLabel”) —Would this line be declared as a function or variable?

Thank you for reading, I’m looking forward to seeing the different perspectives, things i may not have thought about in my method, inconsistencies etc.

Have a happy thanksgiving!

1 Like

Your proof of concept could be established initially using a text label as input and prints as output.
The actual execution of the language would be step two where it would process the interpreted text running the process as if it was a normal script line.

I don’t exactly understand what you’re saying, but if what I’m understanding is correct, then my problem would be your step 2, execution.

Treat the second part as being an interpreter function that reads in the text lines and executes the code derived from the translation. You could for example translate a series of lines for a function and put them is a table and pass the table to the interpreter so it creates a function in a spawn and then uses it when ever that function is mentioned in the lines later read and processed.

1 Like