I notice many developers like to program in their native code language, much like how people like to speak their native verbal language. However, for some people, English may be the only language they know, both coding and irl.
~English is an incredibly easy and incredibly fun natural language to code in. For example, storing variables would be as easy as: Make a variable named example. Set the value of example to 12. Notice: This is a comment line. Look how nice and simple this is.
I want to be able to make a plugin that converts ~English to Lua, but I have no idea how I would do this. There are three major reasons I would want to do this:
This may help ease people into the programming world, making it a fun experience.
I could expand on the language, making more than just console-based.
I have absolutely no idea how to compile anything in Visual Studio, so it would actually be easier to re-make it in Roblox
TL;DR I want to make a programming language converter, I dunno how.
EDIT: A ton of people seem to be a bit confused; I’m not creating a new programming language, but rather trying to port a compiler remake to Roblox Studio.
You’d want to parse this language somehow. You could have a ~English parser which generates an abstract syntax tree and then prints it in Lua syntax. This is a very oversimplified explanation, but judging by you wanting to handle an entire language with grammar it probably won’t be as easy as some pattern matching.
I suggest looking into parsers and ASTs. Your first step after that would probably be defining a grammar of how this ~English language has to be written.
I think coding in lua would actually be easier then coding in english. example = 12 is a lot less messy than Make a variable named example. Set its value to 12. Lua is basically just shorthand English anyway. For example:
if example == 12 then
end
Is literally just this:
If the variable example's value is 12 then run this code
This is the end of the if/then statement.
Only much shorter. I think you should just learn lua, because once you learn the syntax you’ll probably find its just as easy as English.
Secondly, maybe look into some AI for your converting. Maybe its a bad idea to suggest but… maybe try https://dialogflow.com/. It’s a google product that allows you to simulate conversation. However, if you want to spend time to train it to spit out code, I mean you probably could (though you’d be messing it up for people like me. ). It’s be relatively simple as in have a line set to “local variableName” and then the stimulus to make it return that could be a variety (examples like: Make a new variable named variableName; create a new variable called variableName) in the supported languages.
Maybe I’m misunderstanding here. Not entirely sure.
Using English is extremely verbose and would be too much of an annoyance.
Your efforts might be better off directed at some visual scripting solution. Its been shown pretty effective getting even people who know nothing about code into coding.
If you still insist, as mentioned before, you’ll have to research language design. Tokenize, Parse into AST, then compile to desired language.
I 100% know lua (I’m the only programmer for Infinite Autocorrect, No-Scope Sniping, and What’s The Word), and I’ve developed complicated things such as spring bobbing math and entire game systems.
Not to everybody. Regardless, it’s more of a fun language
Actually, that’s not how it’s written (it’s a bit shorter):
If example is 12 then:
(Code here lol ignore this)
That's All.
The point is to have a fun language that doesn’t have typical “code look”.
This is supposed to be a fun language, and wouldn’t be used for anything practical.
i like ( ) the idea behind it, but i also agree with @sparker22 on this one, that it would be verbose. i think it would be better (and more fun for users) to just make something like a vsl (Visual Scripting language ) (like sparker said as well) instead. Where it could possibly be more widely understood by people who aren’t in the programming scene and possibly provide a slightly better workflow for them. However, a thing about vsls is that they often are good at being simple but not providing tools for complex tasks. if you do care about providing that, that’s one thing you are going to have to tackle. But in the chance that you do go the visual scripting route, Perhaps making something like unreal engine’s blueprints would be an ideal solution, which is quite popular among developers.
i actually, was recently planning (still am) to make a visual scripting language myself, Where the idea was to enable a way for people who don’t know much about programming to program, whilst also providing a somewhat powerful tool for “seasoned” programmers.
I was personally planning to use @IdiomicLanguage’s Glr parser, but there are still some other great lua parsers that you can look into. Here’s a website that i found, that might help A Guide To Parsing: Algorithms And Terminology with understanding how you can make your own parser
But anyways that was just my opinion, i would love to see what you come up with either way!