Jump to content




Do you know how to make a Programming Language?



  • You cannot reply to this topic
20 replies to this topic

#1 Pantomchap

  • Members
  • 12 posts

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?

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 30 November 2012 - 02:49 PM

Depends on what you mean by "making a programming language".

In any event, moved to General.

#3 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

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.

#4 Pantomchap

  • Members
  • 12 posts

Posted 30 November 2012 - 03:33 PM

View PostDlcruz129, on 30 November 2012 - 02:52 PM, said:

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.

#5 Mendax

  • Members
  • 366 posts

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)

#6 D3matt

  • Members
  • 830 posts

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.

#7 Jasonfran

  • Members
  • 148 posts
  • LocationEngland

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

#8 tommyroyall

  • Members
  • 136 posts

Posted 01 December 2012 - 09:40 AM

Interpreted, Compiles or Transpiled ; your answer xD.

#9 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 01 December 2012 - 11:31 AM

View PostD3matt, on 30 November 2012 - 09:27 PM, said:

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

#10 tommyroyall

  • Members
  • 136 posts

Posted 01 December 2012 - 02:14 PM

I wrote a BASIC>Lua transpiler :P. DashBASIC for the win xD. https://github.com/S...er721/DashBASIC

#11 D3matt

  • Members
  • 830 posts

Posted 02 December 2012 - 04:10 AM

View PostPixelToast, on 01 December 2012 - 11:31 AM, said:

View PostD3matt, on 30 November 2012 - 09:27 PM, said:

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.

#12 FuuuAInfiniteLoop(F.A.I.L)

  • Banned
  • 435 posts
  • LocationThe left part of this post

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

#13 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 02 December 2012 - 08:59 AM

View PostD3matt, on 02 December 2012 - 04:10 AM, said:

View PostPixelToast, on 01 December 2012 - 11:31 AM, said:

View PostD3matt, on 30 November 2012 - 09:27 PM, said:

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

#14 Xtansia

  • Members
  • 492 posts
  • LocationNew Zealand

Posted 02 December 2012 - 11:08 AM

View PostD3matt, on 02 December 2012 - 04:10 AM, said:

View PostPixelToast, on 01 December 2012 - 11:31 AM, said:

View PostD3matt, on 30 November 2012 - 09:27 PM, said:

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.

#15 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 02 December 2012 - 11:45 AM

View Posttomass1996, on 02 December 2012 - 11:08 AM, said:

View PostD3matt, on 02 December 2012 - 04:10 AM, said:

View PostPixelToast, on 01 December 2012 - 11:31 AM, said:

View PostD3matt, on 30 November 2012 - 09:27 PM, said:

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.

#16 Pantomchap

  • Members
  • 12 posts

Posted 22 April 2013 - 10:01 PM

View PostDlcruz129, on 30 November 2012 - 02:52 PM, said:

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.

#17 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 22 April 2013 - 10: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.

#18 Smiley43210

  • Members
  • 204 posts

Posted 23 April 2013 - 07:45 PM

The guys who made the bukkit plugin CommandHelper created MScript, although I guess it's an interpreter.
http://wiki.sk89q.co...i/CommandHelper

#19 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 23 April 2013 - 08:17 PM

It'd be cool to create a language, which is translated to C/C++, and then compiled.

#20 Espen

    Curious Explorer

  • Members
  • 708 posts

Posted 23 April 2013 - 10:50 PM

View PostPixelToast, on 02 December 2012 - 08:59 AM, said:

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. ^_^





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users