Framework, you are missing the point. No one can go out and just create the next big language from nothing. If you want to learn something new, even the simplest language is worth it. I derove a great deal of satisfaction from something my university professor called "L" which couldn't do much more than print "hello, world".
Here's a couple of my old "L" programs that I was pleased with:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
/* fibonacci.L
Generate fibonacci numbers.
Michael Thomas Greer
5 April 2005
Example usage:
li fibonacci 45
*/
// Get the index to compute.
if length args == 0
then // (From user)
write "Calculate fibonacci of what n?> ";
readln index
else // (From command-line)
index := args::0
end;
index := int index;
// Compute fibonacci( index )
prev := 0;
curr := 1;
cntr := 0;
while cntr < index do
next := prev + curr;
prev := curr;
curr := next;
cntr := cntr +1
end;
result := curr;
writeln ("fibonacci of " + (string index) + " is " + (string result))
// end fibonacci.L
| |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
/* lcm.L
Calculate the Least Common Multiple of N numbers
Michael Thomas Greer
5 April 2005
Example usage:
li lcm 12 13 14
--> result = 1092
*/
if length args < 2
then writeln "You must specify at least two numbers, eg:\n"
+ " li lcm 3 4\n"
+ " li lcm 3 4 5"
else
a := int (args::0); // a <-- first number in list
argi := 1; // index of next number in list
while argi < length args do
b := int (args::argi); // b <-- next number in list
argi := argi +1;
// Calculate the LCM of a and b
ma := a;
nb := b;
while ma != nb do
if ma < nb
then ma := ma +a
else nb := nb +b
end
end;
a := ma // a <-- result of last LCM
end;
result := a;
write "result = ";
writeln result
end // lcm.L
| |
I spent a lot of time on types and type conversion and operators. Looks awful, sure. Doesn't do much, sure. But I learned a lot -- enough to get me started on bigger and more complex things. And I had fun.
So what exactly do you want the OP to create?
Troy
Spend some time figuring out these things:
■ What kind of things do you want your language to do?
■ What do you want your language to look like? What kinds of rules should it follow?
■ What concepts are you familiar with?
That last one is important. How many languages are you familiar with? A good choice to begin writing your own language is to start with a stripped down version of
BASIC or
Tcl.
http://en.wikipedia.org/wiki/BASIC
http://wiki.tcl.tk/
http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm
Both of these are very simply designed, and can be implemented very naïvely with much variation and satisfaction.
Hope this helps.