This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Do you know how to make a Programming Language?
Started by Pantomchap, 30 November 2012 - 12:47 PMPosted 30 November 2012 - 01:47 PM
I've been trying to see if there is a possibility to make a language with computercraft. Any help?
Posted 30 November 2012 - 02:49 PM
Depends on what you mean by "making a programming language".
In any event, moved to General.
In any event, moved to General.
Posted 30 November 2012 - 02:52 PM
Not worth the time. I have no idea how people make programming languages, but it has to take years of development and there's no problem with the languages out there. Because you're on the forums, you probably know Lua. That's a good starting point. The next thing I would learn is Java or C#, then start learning some really advanced stuff, like C++. In the end, don't make your own, just use one of the amazing ones that already exist.
Posted 30 November 2012 - 03:33 PM
I know C# already, but I want to make one with Lua.Not worth the time. I have no idea how people make programming languages, but it has to take years of development and there's no problem with the languages out there. Because you're on the forums, you probably know Lua. That's a good starting point. The next thing I would learn is Java or C#, then start learning some really advanced stuff, like C++. In the end, don't make your own, just use one of the amazing ones that already exist.
Posted 30 November 2012 - 08:00 PM
I have made a few (one was never released, one had one operation per line, I sorta gave up on it (I plan to add the one that was never released to SKS-OS v2.0)), you can check my content to find it if you want. They're just interpreters for files (SScript -> Executable Lua)
Posted 30 November 2012 - 09:27 PM
You can't really make a programming language inside of another language, especially inside of a scripting language. You can make an intepreter, but that's not the same thing.
Posted 01 December 2012 - 06:38 AM
If you are on about a language like Java then that has to have something to run it, like the Java runtime environment which understands compiled Java code, but to make a language that the actual computer understands without any other tools would involve a lot of work
Posted 01 December 2012 - 09:40 AM
Interpreted, Compiles or Transpiled ; your answer xD.
Posted 01 December 2012 - 11:31 AM
lua was made in C, so why cant you make a language in lua?You can't really make a programming language inside of another language, especially inside of a scripting language. You can make an intepreter, but that's not the same thing.
custom inturpreters/compilers are hard to make, its still possible though
Posted 01 December 2012 - 02:14 PM
I wrote a BASIC>Lua transpiler :P/>. DashBASIC for the win xD. https://github.com/Sledger721/DashBASIC
Posted 02 December 2012 - 04:10 AM
Because C is hardware-level and operating systems and drivers are written in C.lua was made in C, so why cant you make a language in lua?You can't really make a programming language inside of another language, especially inside of a scripting language. You can make an intepreter, but that's not the same thing.
custom inturpreters/compilers are hard to make, its still possible though
Posted 02 December 2012 - 04:35 AM
1- Decided how the sintax will work
2- Write a function for each command that you will use
3- Make a splitter and a reader
4- pass the commands to the functions
2- Write a function for each command that you will use
3- Make a splitter and a reader
4- pass the commands to the functions
Posted 02 December 2012 - 08:59 AM
and C is written in assembly or some other low level programming languageBecause C is hardware-level and operating systems and drivers are written in C.lua was made in C, so why cant you make a language in lua?You can't really make a programming language inside of another language, especially inside of a scripting language. You can make an intepreter, but that's not the same thing.
custom inturpreters/compilers are hard to make, its still possible though
and assembly is compiled into bytecode
bytecode is hardware level, not C
Posted 02 December 2012 - 11:08 AM
Because C is hardware-level and operating systems and drivers are written in C.lua was made in C, so why cant you make a language in lua?You can't really make a programming language inside of another language, especially inside of a scripting language. You can make an intepreter, but that's not the same thing.
custom inturpreters/compilers are hard to make, its still possible though
The implementation of Lua ComputerCraft uses is written in Java, And then Java is written in C/C++, Now tell me that isn't a language written in another language written in another language.
Posted 02 December 2012 - 11:45 AM
Because C is hardware-level and operating systems and drivers are written in C.lua was made in C, so why cant you make a language in lua?You can't really make a programming language inside of another language, especially inside of a scripting language. You can make an intepreter, but that's not the same thing.
custom inturpreters/compilers are hard to make, its still possible though
The implementation of Lua ComputerCraft uses is written in Java, And then Java is written in C/C++, Now tell me that isn't a language written in another language written in another language.
Languageception… But what about SScript? A language in a language in a language in a language.
Posted 22 April 2013 - 11:01 PM
I made a language in C# already, but I just wondered if it were possible.Not worth the time. I have no idea how people make programming languages, but it has to take years of development and there's no problem with the languages out there. Because you're on the forums, you probably know Lua. That's a good starting point. The next thing I would learn is Java or C#, then start learning some really advanced stuff, like C++. In the end, don't make your own, just use one of the amazing ones that already exist.
Posted 22 April 2013 - 11:58 PM
Of course it is possible. The raw source code is read through a parser, which produces a syntax tree, something like this maybe(very simple)
Then you'd create a register of variables, with information about types and values and what not. I think that the hardest part will be parsing it.
-- Produce a syntax tree for this code:
--[[
x = 12;
print(x, something_else)
]]
tree = {
{
_type = "def", -- It is a definition
_left = "x", -- The left variable
_right = 12
},
{
_type = "call",
_func = "print",
_args = {"x", "something_else"}
}
}
Then you'd create a register of variables, with information about types and values and what not. I think that the hardest part will be parsing it.
Posted 23 April 2013 - 08:45 PM
The guys who made the bukkit plugin CommandHelper created MScript, although I guess it's an interpreter.
http://wiki.sk89q.com/wiki/CommandHelper
http://wiki.sk89q.com/wiki/CommandHelper
Posted 23 April 2013 - 09:17 PM
It'd be cool to create a language, which is translated to C/C++, and then compiled.
Posted 23 April 2013 - 11:50 PM
Assembly is not compiled into bytecode, Java files are mostly compiled into bytecode.and C is written in assembly or some other low level programming language
and assembly is compiled into bytecode
bytecode is hardware level, not C
Bytecode is then interpreted by the Java VM, it can't run on its own.
Assembly is compiled into object code, which is usually machine code instructions.
@Pantomchap:
In principle you could create a programming language on top of Lua.
But it will be very slow, will not have hardware access and might not have all the necessary standard features.
Also it would need Lua to run, or possibly even CC Lua specifically, because of the way how it does some things differently.
All in all it wouldn't be worth the time, as you wouldn't get anything seriously useful out of it.
As an experiment it might be interesting to do. But I'd rather make some kind of parser that converts one thing into another, that might be much more useful.
Creating a programming language on top of CC Lua is like putting a bike on top of a car, which already stands on top of a truck.
The space in which to operate becomes ever smaller, the speed you can gain becomes less and less, your ability to get access to stuff on the road becomes less and less, etc.
But even if you didn't have these limitations, creating a serious programming language is no easy business and a science of its own.
If you aren't a programming wizard with some of the more serious programming languages already, then it's like trying to dig a tunnel through a mountain armed with only a spoon. ^_^/>
Posted 24 April 2013 - 12:00 AM
I have been thinking about creating a very simple programming language for a long time. Well, not really programming language, but something like Assembly, except you would not edit "real" memory, just something which was allocated by the interpreter(yes, there'd be an interpreter).