Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Creating your own programming language

Name: Anonymous 2008-10-24 14:44

Has anyone here every created their own programming language? What was the syntax like, and what did you use to implement the language? Using Haskell to implement your language is cheating BTW, so don't even post here if your language is made from Haskell.

Name: Anonymous 2008-10-24 14:54

Here's a sample of my programming language. I used Bison/Flex to lex and parse it. Everything was done in C. It's very simple and similar to C.


int
main()
{
  print "Hello World";
  return 0;
}

Name: Anonymous 2008-10-24 16:19

>>2
FUCK YOU

Name: Anonymous 2008-10-24 16:35

>>3
Why??

Name: Anonymous 2008-10-24 17:16

>>3
Stroustrup?

Name: Anonymous 2008-10-25 0:41


(print "Hello World")

Name: Anonymous 2008-10-25 9:26

Name: Anonymous 2008-10-25 9:41

>>1
I implemented a C lexer in Haskell

Name: Anonymous 2008-10-25 10:25

>>7
Hello, Thomas.

Name: Anonymous 2008-10-25 10:26

Name: Anonymous 2008-10-25 11:26

>>10
This is just Brainfuck with As, Bs, and Cs.

Name: Anonymous 2008-10-25 13:42

I rewrote Tcl in QBasic once. Shit wasn't capable of more than two nested function calls, but it worked.

Name: Anonymous 2008-10-25 15:02

I rewrote LAMBDA CALCULUS in LAMBDA CALCULUS once. Shit wasn't capable of more than two nested function calls, but it worked.

Name: Anonymous 2008-10-25 15:12

Yo dawg I herd u like term substitution, so we put a lambda calculus in your lambda calculus so u can beta-reduct while u beta-reduct

Name: Anonymous 2008-10-25 15:38

>>14
I don't get this joke. It seems like it could be funny if you get it but I don't so fuck off.

Xarn, over and out.

Name: Anonymous 2008-10-25 16:10

>>14
The verb from which ``reduction'' is derived is not, oddly, ``to reduct''. That would just be something you could do after you removed the ducts from something.

Name: Anonymous 2008-10-25 16:35

Mine is the best

Public Shared Function AreYouAFag(ByVal You As Person) As Boolen
   If TypeOf(You) Is Fag Then
      Return True
   End If
   Return True
End Function

Name: Anonymous 2008-10-25 16:51

>>17
this language looks like Transformers
it's designed for kids and it's all fucking stupid and made of idiotic bits and peices that don't actually do anything

Name: Anonymous 2008-10-25 16:56

>>18
It's the "let's have lots of keywords instead of difficult mathematical-ish operators" school of language design. Too bad it makes code almost impossible eyeball.

Name: Anonymous 2008-10-25 17:16

>>18
>>19

Semicolins are the corner or a good programming laguage.

And parenthesis.

Case sensatvity. value and Value are obvoously completley different things.

And the inability to determine equality and and assigment based on context.

if(You == Fag)
{ //start of this if statement
      return 1;
} //end of this if statement
else
{ //start of this if statement's else
      return 1;
} //end of this if statement's else

Name: Anonymous 2008-10-25 17:20

>>17
As Boolen

Name: Anonymous 2008-10-25 17:51

did this: http://hactar.net/stutter/

written in C, including my own garbage collector.

Name: Anonymous 2008-10-25 17:57

>>22
Hello, Máté Nagy, where are you from?

Name: Anonymous 2008-10-25 18:05

>>21

It's trinary value type

Name: Anonymous 2008-10-25 20:45

>>23
Perhaps you meant Jo estét.

Name: Anonymous 2008-10-26 11:18

>>25
What

Name: Anonymous 2008-10-26 13:08

>>22
Originally, it was indented for purely educational purposes; but since then, it has seen entirely too much use in production environments,

Name: Anonymous 2008-10-26 14:29

Name: Anonymous 2008-10-27 1:03

I've pondered making my own. I explored a variety of paradigms and languages (Lisp, Java, C/C++, Objective-C, Python, Ruby, VB, C#, etc). I wanted a fairly easy to read language. I also debated over having the language also be its own macro language. For the syntax, I chose to allow nearly every character to be an identifier (parenthesis and brackets being the only exception). White space would be the only only delimiter. I also wanted commands separated by a linefeed (since nearly all lines of code use just one line) with a character for line extension. All 'operators' are simply just identifiers. Functions can be declared to allow for only prefix notation (outside of the parenthesis) or infix notation (like operators). I never quite concluded on how infix evaluation priority would be determined. I wanted inline, anonymous (lambda) functions. But again I wasn't sure how I could abstract program flow commands and declarations so everything use the same form.

Basically I wanted the consistency and flexibility of Lisp with an easier syntax like Python. However after using Netbeans, I realized the program syntax is almost irrelevant when you have an IDE that can be wielded like the raw power of a god.

Name: 29 2008-10-27 1:07

I see now that Seed7 does some of the things I was exploring. Interesting.

Name: Anonymous 2008-10-27 1:34

>>29
I think you meant to say Emacs.

Name: Anonymous 2008-10-27 1:48

>>29
Lisp with an easier syntax like Python
Wat. It doesn't get easier than Lisp, except for maybe Forth, which is harder to follow even though there's less structure to bother with.

Name: Anonymous 2008-10-27 2:34

If you're going to release a language at least try to make it practical because you might get a job out of it 10 years later (GvR).

Name: Anonymous 2008-10-27 4:05

>>32
Easier to write on regular bases, not to understand basics

Name: Anonymous 2008-10-27 10:39

I think the perfect language wouldn't have keywords at all.

Name: Anonymous 2008-10-27 10:55

BRAIN FUCK

Name: Anonymous 2008-10-27 11:05

>>36
A helpful and relevant message on /prog/ would be the biggest brainfuck of them all.

Name: Anonymous 2008-10-27 15:16

Serious answer is serious:

If you just want a VERY easy to implement language that coders (probably just yourself) will use, then go for stack-based.

If you need anything else, jam a DSL on top of Lisp with its macro system.

Name: Anonymous 2008-10-27 18:19

>>38
Can someone please explain what the fuck is a DSL?

Name: Anonymous 2008-10-27 18:28

(Post truncated.)

Name: Anonymous 2008-10-27 18:28

Dyslexian Sex Lord.

Name: Anonymous 2008-10-27 20:32

Dick Sucking Lesbian.  If you can find one, that is.

Name: Anonymous 2008-10-27 21:28

>>39
Domain Specific Language.
(Fuck off, you DON'T HELP HIM faggots.)

Also, if you just want to play around with designing a language and don't want it to look exactly like every other goddamn Lisp clone, take a look at Parrot. It's pretty easy to dump out PIR code. As for parsing, try Haskell (or Python with pyparsing, if haskell isn't your thing).

That should be more than enough to get you started; if you've any experience with lower level code (that is, if you've written a few things in assembler, or at the very least, lots and lots of stuff in C) you should be able to hammer away at some code and get a not-very-well-designed, but entirely functioning language, in less than 500 lines of code.

The best part about doing it this way is it won't be just another stupid Lisp or Forth clone.

Name: Anonymous 2008-10-28 15:31

>>43
DON'T HELP HIM

Name: Anonymous 2008-10-28 16:47

>>35
http://seed7.sourceforge.net/
# User defined statements and operators.
# Predefined constructs like arrays or for-loops are declared in the language itself.

Name: Anonymous 2008-10-28 16:59

have an IDE that can be wielded like the raw power of a god
Making the language easy to parse will make it easier for an IDE to manipulate the code.

There are many choices for types of parsers (a.k.a. syntactical analyzer):
Bottom-up (a.k.a. "shift-reduce parsing")
Left-to-Right ("LR")
Left-to-Right(0)  ("LR(0)")
Left-to-Right(1)  ("LR(1)")
Left-to-Right(k)  ("LR(k)")
Simple Left-to-Right ("SLR")
Look-Ahead Left-to-Right ("LALR")
Generalized Left-to-Right ("GLR")
?? (CLR)

Top-down
Left-to-Left ("LL")
Packrat

The most well known are flex/bison and Antlr, which I believe these are all LR parsers. There is also the Boost "Spirit" library, which I would use to throw together some easy parsing.

Some grammars:
Backus–Naur form (a.k.a. "BNF", "Backus–Naur formalism", "Backus normal form", "Panini–Backus Form")
Parsing expression grammar ("PEG")
Chomsky normal form ("CNF")

Context free grammars:
Cocke-Younger-Kasami ("CYK")
Earley
Generalized Left-to-Right ("GLR")

Name: Anonymous 2008-10-28 17:19

>>46
C was written to be "easy to parse".  Fuck that.  Make it context-free.

Name: Anonymous 2008-10-28 18:07

>>47
If your computer language can be parsed by a PDA, it's not going to be very powerful.

Name: Anonymous 2008-10-28 18:22

>>48
1/10

Name: Anonymous 2008-10-28 18:46

>>46

If that were true then C# would provide a better IDE than VB.Net in Visual Studio. It does not.

It can't even tell if I am referring to a member or a method until compile time and then give me an error if I forgot the fucking parenthesis. VB.Net doesn't require those useless fucking parethesis but it does catch other syntax errors right away.

And that is not to say that Visual Studio sucks. It still provides the best IDE for an C style syntax language.

Name: Anonymous 2008-10-28 18:56

ANTLR is actually LL(*), despite the name.

Name: Anonymous 2008-10-28 21:21

>>50
It still provides the best IDE for an C style syntax language.
Not really, Eclipse is better

Name: Anonymous 2008-10-29 16:40

This thread is threadstopped. You can't reply anymore.

Name: Anonymous 2008-10-29 16:40

This thread is threadstopped. You can't reply anymore.

Name: Anonymous 2008-10-29 17:00

This thread is threadstopped. You can't reply anymore.

Name: Anonymous 2011-02-03 7:22


Don't change these.
Name: Email:
Entire Thread Thread List