Scripting Language project...

Started by
14 comments, last by Mike 24 years ago
Lance:

I''m not ignorant (I just can''t spell) nor am I cocky. I know my place at the bottom of the programming chain. You don''t seem to realize that this is a simple language that I am creating for an aditional credit in HIGH SCHOOL. I''ve completed the code to handle input, output, and ifs from the syntax tree to compilation. This means that I have roughly 10 weeks to write a simple parser.

I know that parsers and lexers are insane tasks to take on and if I were to write a very complex (or even somewhat complex) language I would use flexx and bison (or flexx++ and bison++... but I''ve heard that those aren''t to good); however, as SiCrane pointed out, I''m not about to write the language to replace Python.

Please realize that I am doing this to further my programming abilities. Generating code with lexx and yak is not exactly going to enrich my programming abilities (in perticualar: problem solveing). Even if I fail at writing the parser I will still get the additional credit and I will still learn something.
Advertisement
I totally agree with Mike on this one.
Check into Forth. It is an extremely simple language which runs on a word-based system. Even things like math are in reverse notation, so instead of having to parse x = 3 + 4, you get 3 4 + x ! (the ! sets the variable x to the top integer on the stack). It has polymorphic variables of global scope only. It requires that you become very familiar with the whole "stack" thing, but you can only become better because of it. I believe MUCKs are programmed with a Forth derivative.

I wrote a Forth interpreter as a Freshmen in College, and I don''t think the thing was more than 700 lines. Geez, that wasn''t that long ago, yet I am so much better at programming. Maybe for kicks, I''ll rewrite it or something...maybe make it OOP. That''d be worth a giggle or two...
I've also tried to write a scripting language parsing C++ scripts and compiling them into bytecode in singlepass (don't laugh!). The bytecode was risc-like and it mainly used registers (rather than being a stack machine).

Well, a huge bunch of unexpected problems arised, so I stopped and decided to use something like GENTLE or PCCTS, because bison/flexx doesn't seem like it's learnable in a week or so

Anyway, what I've completed yet could easily transformed into a good, solid tokenizer (preprocessor), so if someone likes to take a look at:
http://www.lunaticsystems.de/scrix.zip

-Markus-

Edited by - Cygon on 3/15/00 9:46:09 PM
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
I don''t really know why I''m writing this here, just thought I''d share my experience.

I tried to construct my own scripting language for a game project I''m working on (using flex and bison). I had attained the level of functionality that C provides and I wanted to give it the ability to define and use user-defined objects. That''s where the brick wall approached. As a 2nd-year programmer, I hardly knew enough to handle objects, and I certainly didn''t understand the recursive nature of the parser. So I gave up. But now that I look back, I think it''s actually quite good. I even figured out how to export C functions on my own (Mike - I posted the solution I used in another post somewhere) and get the byte code to execute quite nicely on the virtual machine. It even did a two-level compile, making virtual assembly first and then converting to bytecode.
Anyway, I wish you the best of luck Mike and hope you get the language working.
I''ve figured out how to export native functions to the scripting language on my own (I asked how to do it, but I didn''t really like the way that other people did it so I went my own way). I have no plans to implement objects or user defined data types. I only need to add functions to the scripting language (it will not take long to acomplish based on the fact that I''ve already implemented a label and a jump virtual machine op code) and I will be almost done. I only need to write a lexer and a parset (unlike the functions, this will take for ever to get done).

Just incase you wondered.

This topic is closed to new replies.

Advertisement