This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Pantomchap's profile picture

Do you know how to make a Programming Language?

Started by Pantomchap, 30 November 2012 - 12:47 PM
Pantomchap #1
Posted 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?
Lyqyd #2
Posted 30 November 2012 - 02:49 PM
Depends on what you mean by "making a programming language".

In any event, moved to General.
Dlcruz129 #3
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.
Pantomchap #4
Posted 30 November 2012 - 03:33 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.
I know C# already, but I want to make one with Lua.
Mendax #5
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)
D3matt #6
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.
Jasonfran #7
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
tommyroyall #8
Posted 01 December 2012 - 09:40 AM
Interpreted, Compiles or Transpiled ; your answer xD.
PixelToast #9
Posted 01 December 2012 - 11:31 AM
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.
lua was made in C, so why cant you make a language in lua?

custom inturpreters/compilers are hard to make, its still possible though
tommyroyall #10
Posted 01 December 2012 - 02:14 PM
I wrote a BASIC>Lua transpiler :P/>. DashBASIC for the win xD. https://github.com/Sledger721/DashBASIC
D3matt #11
Posted 02 December 2012 - 04:10 AM
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.
lua was made in C, so why cant you make a language in lua?

custom inturpreters/compilers are hard to make, its still possible though
Because C is hardware-level and operating systems and drivers are written in C.
FuuuAInfiniteLoop(F.A.I.L) #12
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
PixelToast #13
Posted 02 December 2012 - 08:59 AM
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.
lua was made in C, so why cant you make a language in lua?

custom inturpreters/compilers are hard to make, its still possible though
Because C is hardware-level and operating systems and drivers are written in C.
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
Xtansia #14
Posted 02 December 2012 - 11:08 AM
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.
lua was made in C, so why cant you make a language in lua?

custom inturpreters/compilers are hard to make, its still possible though
Because C is hardware-level and operating systems and drivers are written in C.

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.
Dlcruz129 #15
Posted 02 December 2012 - 11:45 AM
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.
lua was made in C, so why cant you make a language in lua?

custom inturpreters/compilers are hard to make, its still possible though
Because C is hardware-level and operating systems and drivers are written in C.

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.
Pantomchap #16
Posted 22 April 2013 - 11:01 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.
I made a language in C# already, but I just wondered if it were possible.
Mads #17
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)

-- 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.
Smiley43210 #18
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
Mads #19
Posted 23 April 2013 - 09:17 PM
It'd be cool to create a language, which is translated to C/C++, and then compiled.
Espen #20
Posted 23 April 2013 - 11:50 PM
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
Assembly is not compiled into bytecode, Java files are mostly compiled into bytecode.
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. ^_^/>
Mads #21
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).