School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,150 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,697 people online right now. Registration is fast and FREE... Join Now!




How o make your own Programming language ?

2 Pages V  1 2 >  

How o make your own Programming language ?, ???

Rickster0

12 Nov, 2008 - 08:18 AM
Post #1

D.I.C Head
Group Icon

Joined: 8 Jul, 2008
Posts: 187



Thanked: 11 times
Dream Kudos: 150
My Contributions
how can i make my own programming language...

i want to make my own for one of my projects can anybody give me a hand


User is offlineProfile CardPM
+Quote Post


PsychoCoder

RE: How O Make Your Own Programming Language ?

12 Nov, 2008 - 08:47 AM
Post #2

I Code, Therefore I am
Group Icon

Joined: 26 Jul, 2007
Posts: 14,937



Thanked: 517 times
Dream Kudos: 11575
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

My Contributions
Given your current level of understanding of programming, OOP concepts and such (not trying to be rude or anything I swear, I just making this observation from your questions in the VB.NET forum) I would say taking on a project like this is well above your head. Creating a language is no simple task, it takes a team years to develop and debug a language
User is offlineProfile CardPM
+Quote Post

Rickster0

RE: How O Make Your Own Programming Language ?

12 Nov, 2008 - 08:53 AM
Post #3

D.I.C Head
Group Icon

Joined: 8 Jul, 2008
Posts: 187



Thanked: 11 times
Dream Kudos: 150
My Contributions
oh ok...also no offense is taken since i know im not great at proggramming so no worries.. and ok.. i just wanted to know how to do it thats all..
User is offlineProfile CardPM
+Quote Post

Hary

RE: How O Make Your Own Programming Language ?

12 Nov, 2008 - 09:53 AM
Post #4

D.I.C Regular
Group Icon

Joined: 23 Sep, 2008
Posts: 411



Thanked: 40 times
My Contributions
Start off with some reading: Programming Language Processors in Java - Compilers and Interpreters (Watt & Brown)

But, be aware! Building a complete langue is hard and there are university courses about them, still not covering all aspects.
User is offlineProfile CardPM
+Quote Post

gabehabe

RE: How O Make Your Own Programming Language ?

12 Nov, 2008 - 12:48 PM
Post #5

Sexy DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 8,864



Thanked: 177 times
Dream Kudos: 3275
Expert In: Lots of things.

My Contributions
As Psycho said, no offense, but it's really above you. HOWEVER. [read on]

You could make your own interpreted language. That's not difficult. It's basically just reading in a file, and either:
1) Outputting the "translated" code to a language which you DO know
2) Running it directly through your interpreter. No secondary code.

Here's an example~ I wrote my own Brainfuck interpreter the other day.
[click for blog entry]

Note, this is a really simple interpreter. Brainfuck only has 8 commands.
cpp
/*
* A brainfuck interpreter
* Author: Danny Battison
* Contact: gabehabe@gmail.com
*/

#include <iostream>
#include <fstream>
using namespace std;

void DisplayHelp();

int main(int argc, char *argv[]) {
if (argc < 2 || argc > 3) {
DisplayHelp();
return EXIT_FAILURE;
}
if (!strcmp(argv[1], "-?")) {
cout << "BRAINFUCK INTERPRETER: WRITTEN BY DANNY BATTISON" << endl
<< "This program is designed to interpret a brainfuck application." << endl
<< "Written in C++" << endl
<< "Contact the author: gabehabe (at) gmail (dot) com";
}

else if (!strcmp(argv[1],"-i")) {
if (argc < 2 || argc > 3) {
DisplayHelp();
return EXIT_FAILURE;
} else {
ifstream file;
file.open(argv[2]);
if (!file.is_open()) {
cout << "ERROR: File could not be found.";
return EXIT_FAILURE;
}
string bf = "";
char buffer;
file.get(buffer);
bf += buffer;
while (!file.eof()) {file.get(buffer); bf += buffer;}
file.close();
char* ptr = new char[5000];
int sub;
for (sub = 0; sub < 5000; sub++) ptr[sub] = 0;
sub = 0;

unsigned int i;
int loopPosition = -1;
for (i = 0; i < bf.length(); i++) {
switch (bf[i]) {
case '+': ptr[sub]++; break;
case '-': ptr[sub]--; break;
case '>': sub++; break;
case '<': sub--; break;
case '.': cout << ptr[sub]; break;
case ',': ptr[sub] = getchar(); if (ptr[sub] == 13) {ptr[sub] = '\0'; loopPosition = -1;} break;
case '[': loopPosition = i; break;
case ']': if (loopPosition != -1) {if (ptr[sub] != '\0') i = loopPosition-1; else loopPosition = -1;} break;
}
}
}
return EXIT_SUCCESS;
}
}

void DisplayHelp() {
cout << "Invalid arguments. Example Usages:" << endl
<< "\tInterpret:\tbf.exe -i C:\\file.bf" << endl
<< "\tAbout:\t\tbf.exe -?";
}


Other than that, I'd say avoid trying to make your own compiled language. I'm getting books on it soon, I'll most likely be blogging about it. Keep an eye out, I try to write stuff in layman's terms.
User is offlineProfile CardPM
+Quote Post

muballitmitte

RE: How O Make Your Own Programming Language ?

12 Nov, 2008 - 11:53 PM
Post #6

D.I.C Head
Group Icon

Joined: 5 Nov, 2008
Posts: 81



Thanked: 10 times
Dream Kudos: 75
My Contributions
and how is what you wrote helping him? *confused*
User is offlineProfile CardPM
+Quote Post

no2pencil

RE: How O Make Your Own Programming Language ?

12 Nov, 2008 - 11:55 PM
Post #7

i R L33t Skiddie, k?
Group Icon

Joined: 10 May, 2007
Posts: 13,499



Thanked: 303 times
Dream Kudos: 2875
Expert In: Goofing Off

My Contributions
HAHAHAHA, in your face Gabe!

Hey, does anyone else smell toast?
User is online!Profile CardPM
+Quote Post

gabehabe

RE: How O Make Your Own Programming Language ?

13 Nov, 2008 - 05:30 AM
Post #8

Sexy DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 8,864



Thanked: 177 times
Dream Kudos: 3275
Expert In: Lots of things.

My Contributions
Because it's an example to show him how an interpreter works.

And I don't smell toast. Though I could earlier. Around the same time that you posted that.
User is offlineProfile CardPM
+Quote Post

no2pencil

RE: How O Make Your Own Programming Language ?

13 Nov, 2008 - 06:30 AM
Post #9

i R L33t Skiddie, k?
Group Icon

Joined: 10 May, 2007
Posts: 13,499



Thanked: 303 times
Dream Kudos: 2875
Expert In: Goofing Off

My Contributions
Attached Image
User is online!Profile CardPM
+Quote Post

muballitmitte

RE: How O Make Your Own Programming Language ?

13 Nov, 2008 - 06:35 AM
Post #10

D.I.C Head
Group Icon

Joined: 5 Nov, 2008
Posts: 81



Thanked: 10 times
Dream Kudos: 75
My Contributions
hahahahaahahahahaha
User is offlineProfile CardPM
+Quote Post

KYA

RE: How O Make Your Own Programming Language ?

13 Nov, 2008 - 07:21 AM
Post #11

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 11,500



Thanked: 508 times
Dream Kudos: 2875
Expert In: C, C++, Java

My Contributions
No2 you have made my day. smile.gif Burnt toast gabe!
User is online!Profile CardPM
+Quote Post

gabehabe

RE: How O Make Your Own Programming Language ?

13 Nov, 2008 - 01:07 PM
Post #12

Sexy DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 8,864



Thanked: 177 times
Dream Kudos: 3275
Expert In: Lots of things.

My Contributions
It's funnier because you can still see where you didn't crop the corners properly. laugh.gif

Future reference: gabehabe~ All lower case. See, this is why I don't call any more.

EDIT: also looks like someone went a little crazy with the clone tool in PS. no2, did you do that, or was it that shoddy when you found it? laugh.gif
User is offlineProfile CardPM
+Quote Post

Hary

RE: How O Make Your Own Programming Language ?

13 Nov, 2008 - 01:16 PM
Post #13

D.I.C Regular
Group Icon

Joined: 23 Sep, 2008
Posts: 411



Thanked: 40 times
My Contributions
Very useful topic about compilers here!
User is offlineProfile CardPM
+Quote Post

no2pencil

RE: How O Make Your Own Programming Language ?

13 Nov, 2008 - 01:19 PM
Post #14

i R L33t Skiddie, k?
Group Icon

Joined: 10 May, 2007
Posts: 13,499



Thanked: 303 times
Dream Kudos: 2875
Expert In: Goofing Off

My Contributions
QUOTE(gabehabe @ 13 Nov, 2008 - 03:07 PM) *

It's funnier because you can still see where you didn't crop the corners properly

EDIT: also looks like someone went a little crazy with the clone tool in PS. no2, did you do that, or was it that shoddy when you found it? laugh.gif

M$Paint ftw. I just did a Google Images search. tongue.gif

User is online!Profile CardPM
+Quote Post

gabehabe

RE: How O Make Your Own Programming Language ?

14 Nov, 2008 - 04:57 AM
Post #15

Sexy DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 8,864



Thanked: 177 times
Dream Kudos: 3275
Expert In: Lots of things.

My Contributions
QUOTE(Hary @ 13 Nov, 2008 - 08:16 PM) *
Very useful topic about compilers here!

Toast compiles my code, so I don't have to.
User is offlineProfile CardPM
+Quote Post

Rickster0

RE: How O Make Your Own Programming Language ?

17 Nov, 2008 - 05:59 AM
Post #16

D.I.C Head
Group Icon

Joined: 8 Jul, 2008
Posts: 187



Thanked: 11 times
Dream Kudos: 150
My Contributions
lol

User is offlineProfile CardPM
+Quote Post

reyben_89

RE: How O Make Your Own Programming Language ?

1 Dec, 2008 - 09:46 PM
Post #17

D.I.C Head
**

Joined: 30 Nov, 2008
Posts: 60



Thanked: 2 times
My Contributions
QUOTE(gabehabe @ 13 Nov, 2008 - 01:07 PM) *

It's funnier because you can still see where you didn't crop the corners properly. laugh.gif

Future reference: gabehabe~ All lower case. See, this is why I don't call any more.

EDIT: also looks like someone went a little crazy with the clone tool in PS. no2, did you do that, or was it that shoddy when you found it? laugh.gif

biggrin.gif
testings
User is offlineProfile CardPM
+Quote Post

Rickster0

RE: How O Make Your Own Programming Language ?

3 Dec, 2008 - 08:47 AM
Post #18

D.I.C Head
Group Icon

Joined: 8 Jul, 2008
Posts: 187



Thanked: 11 times
Dream Kudos: 150
My Contributions
this makes no sense ???

can anyone answer my Question .
User is offlineProfile CardPM
+Quote Post

gabehabe

RE: How O Make Your Own Programming Language ?

6 Dec, 2008 - 06:55 AM
Post #19

Sexy DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 8,864



Thanked: 177 times
Dream Kudos: 3275
Expert In: Lots of things.

My Contributions
...It's already been answered.

Compiler theory. No offence, but I wouldn't say you're ready for it yet.

Heck, I don't think I'm ready for it. But I've got two books on the way.

I'll blog about it soon.
User is offlineProfile CardPM
+Quote Post

Rickster0

RE: How O Make Your Own Programming Language ?

8 Dec, 2008 - 05:45 AM
Post #20

D.I.C Head
Group Icon

Joined: 8 Jul, 2008
Posts: 187



Thanked: 11 times
Dream Kudos: 150
My Contributions
oh allright...
User is offlineProfile CardPM
+Quote Post

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 04:34PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month