Advertisement

Scripting Language Syntax Proposal

Started by April 13, 2004 10:38 AM
118 comments, last by irbrian 20 years, 9 months ago
quote:
Original post by irbrian
* I sure hope Oluseyi doesn''t mind that I borrowed his @ notation...
I can lay no claim to it, as I encountered it on this site as well. By all means, use it; I think it''s great for "directing traffic."

quote:
Would it make everyone happier if I kept the ''var'' keyword, but just used var''s as standard variants, but still allowed explicit creation of typed variables?
I think the core issue here is that scripting languages are supposed to appeal to non-programmers - artists, end users, and so on. To those people, notions such as type are quaint, and should be hidden as much as possible. When we use symbolic notation in other spheres, we don''t have arbitrary restrictions on symbol reuse or what kinds of values can "occupy" a symbol, so why should we do that in a scripting language? To my mind, a good scripting language looks as much like mathematical formula - with the same behavior - as possible.

In my experience, the addition of type makes a language less learnable for non-programmers while the omission of type is a non-issue for programmers. Win-win situation with omission if you ask me.
..? with the HTMLish tags, i turn on/off the form loader/ scripting engine/Extra maths functions/DLL loader.
Think of it as a way to add extra stuff to your scripting language without all the hastle of actually using it all the time! (my scripting language speeds skyrocketed seeing as most of the time, the command decoder only needs to call 2-3 Functions)

Theres one way to to basicly everything, (exept err handling and interupts, but my scripting language was made to be for a FSM!)

[edited by - Nice coder on April 16, 2004 10:10:35 PM]
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Advertisement
Well guys, having created several languages in Lex/Yacc and Recursive Descent parsers, I must say this. It''s not as easy as you think :-)

It''s easy to get started but you have to have a lot of determination because alot of problems will show up and you have to work them through. You need alot of patience.

Not to mention real time garbage collection, now that will make your hair turn white.


I believe it, PeterTarkus. I am convinced that nearly everything I''ve been proposing would be extremely difficult to achieve. But I do intend to accomplish it at some point. I''m wanting to finalize the syntax now so that I have a clear vision of what I''ll be working toward, and what kind of internal handling will be required, etc.

I won''t actually be building the whole thing all on my own, either, but I won''t get into that now -- other than to remind people that I''m certainly interested in volunteers, if anyone is so ambitious.

****************************************

Brian Lacy
ForeverDream Studios

Comments? Questions? Curious?


"I create. Therefore I am."
---------------------------Brian Lacy"I create. Therefore I am."
Well, if you get a project going with a design and a ''comittee'' I''d be willing to give a hand here and there.

How are you going to do the parser? Recursive descent? Lex/Yacc? DFA scanner? ANTLR?

What kind of Virtual Machine do you plan to build? Register style? Stack style? List based?

Recursive descent is the easiest to hack out, but it can start getting ugly when the grammar gets deviant. Lex/Yacc are painful, but you are guaranteed when you get it working right it will work without ambiguities. I never tried ANTLR or Boost::Spirit (LL(K)) yet.

Python uses some nifty DFA scanners, it''s worth looking at it just to see how it works. It is pretty neat.

I think I already tried to convert you to Scheme without any luck.

Peace->out
Never having done any parser/compiler work before, I must say I was entirely impressed with Spirit. It''s a lot to swallow at first, but once I understood some of the basic concepts I was able to whip up a configuration file parser for my desired syntax (see earlier in the thread) within an evening or two. And that''s in between a full-time job and feeding twin newborn babies!

The toughest part was getting the grammar right because my configuration files allow C/C++ comments embedded anywhere they can be embedded in C/C++ code. But that was a problem with my grammar, not with Spirit (changed the grammar and everything worked as expected). You can check it out here.

Regards,
Jeff


[ CodeDread ]
Advertisement
to: Oluseyi

I agree, non-programmers will be hindered by the direct use of types. But, I believe that the use of var to a non-programmer will signal the declaration of a variable, as oppossed to a lhs reference. Also, this would improve the parser, as it can easily determine a variable declaration by "seeing" the var keyword.
Elendil!
Wow, trying to keep up with this thread is exrutiating! :-)
I have spent the last 16 months learning all I can about compiler\parser design and developement; as well as virtual machine (VM''s), and computer proccessor designs, and computer hardware architecture. I have a done a lot of reading, and especially of lex\yacc, ANTLR, and just recently the Spirit parser.
I definately like the unique design that Spirit incorperates -
using template expressions, and a great example of operator overloading that makes; two very usefull features.
Personally, I would like to write my own compiler from scratch;
as well as a virtual proccessor. I would rather write my own because I feel that I could develope it with my own design.
Not that I think it would be better than using one of these great tools (Spirit and ANTLR being at the top of my list), but I want to feel like I did this language from scratch myself; plus it''s a good lesson in complex design and developement.

Elendil!
It is alot of fun :-) I am not a compiler wizard by any means though. Modern architectures with SIMD and cache tuning is very hard to write a good compiler for..

If you want to get your feet wet doing a VM design go to my page and look at the links. The book on stack machines is a good place to start.

http://xano.sourceforge.net

If you mean REAL virtual machine design like emulating a real CPU than look for 6502 emulators. It is a very simple architecture and the code base for them is real easy to figure out (very small). I started by making a 6502 emulator and assembler for it.

Have fun.

to: PeterTarkus

Actually, I have gone to it already, and it
has a lot of great information! Thanks!
I am enjoying all the info on stack machines.
I have been design my current VM using stack implementations.
I'm working on a design to use stacks to implement a parser (more details required).

Again, thanks for such great info!


[edited by - I_Animated on April 17, 2004 4:49:14 AM]
Elendil!

This topic is closed to new replies.

Advertisement