http://regedit.gamedev.pl/ Graphics programming, game programming, C++, games, Windows, Internet and more... |
| Main Page | Blog | Productions | Gallery | Download | Links | About me |
17:44
Wed
30
Dec 2009
RegScript - my Scripting Language
RegScript is my scripting language I've started coding yesterday. I'm not a guru in formal languages theory, but I'm quite fascinated with programming languages, parsers and interpreters. I don't know why but I felt I'd love to write my own programming language so I just started coding it, even if it doesn't make any sense. Maybe that's just because it's like being the creator of something that we, as developers, are usually only users. The language syntax is similar to C++. Here are features I've coded untill now:
-10, 0xFFFF, 0b1010, 1e-6f, false, true, 'A', "foo"
+ - * / % < ?: ! && || ~ & | ^ << >>
= += -= *= /= %= &= |= ^= <<= >>= ++ -- == != < > <= >= ( ) sizeof ,
sin, print, intrinsic constants: PI.
The implementation is not optimal yet as I don't generate any bytecode. I just execute statements and evaluate expressions from a tree made of polymorphic nodes dynamically allocated by parser. Sample program:
print("Hello World!\n");
for (auto i = 0; i < 10; i++)
print("i = " + i + '\n');
Comments (2) | Tags: scripts compilers regscript
| Kos 2009-12-31 01:35:51 | String + int? = String? Hmm, this leads to questions like what is "2" + 2 - should String be cast to int or the other way? Which is more logical? The best answer in terms of "Least WTF principle" seems to be 'force the programmer to make it explicit'. This also pretty much explains the '.' (concat) operator in PHP. --- Neglecting some nuances, you seem to have estabilished a nice subset of the D language so far and I wonder how far will this similarity continue. :) |
| Xion 2009-12-31 10:32:36 | Your manner to insert D propaganda in every place possible is starting to annoy me, Kos ;P |
| [Stat] [Admin] [STAT NO AD] [pub] [Mirror] | Copyright © 2004-2010 Adam Sawicki | 0.04 s |