www.digitalmars.com         C & C++   DMDScript  

DMDScript - QScript

reply Dan <Dan_member pathlink.com> writes:
Hi guys,

I'm still around.  Work's been busy, and I've been studying parser design theory
whenever I think of my project.  At the moment, I've got approximately 50% of
the work done.

The engine is under 'the new BSD License'.

The object framework, properties/methods/attributes, and inheritance works.  It
is class-less, and very lean, with 8 byte overhead for objects, and 20 byte
overhead for each property.  It is written as an 2-d array of property structs.

The interpreter internally uses Global_eval to handle source text after calling
a Global_init() to set up a copy of the Object framework.  This allows us to run
multiple script environments in one process; but could be forsaken by using the
static data instead of copying in cases where memory size is crucial.  The
program initialization amounts to a memcpy() followed by setting about a dozen
pointers and then it's done.

I figured out that with some trickery I can make the arguments object a mask to
the x86 stack.

The lexer works, all the text and error messages are done, it is roughly 10-20%
faster than DMDScript when I test it on my folder of scripts.  I'd imagine if I
hand coded the jump gate I could probably squeeze another 15% out.

The program so far doesn't use a parser, and all of the methods and operators
are empty husks.  I vaguely remember that most ECMAScript engines use some sort
of tokenization/bytecode.  My lexer has been creating Values, some of which are
char[]'s pointing to a TEXT_something, some are numbers, some are dup'd from the

What I need to know is what to do with program flow, flow control, scope, and
opcodes.  Then I can finish my parser and get that all written up pretty.  Once
that's done, I'll release the source, and it'll be a simple matter of populating

At this point, I'm not hugely motivated to finish this.  It's a hobby project,
so it might take a while.  When I _am_ done though, I'll be doing
ECMA-conformance testing on the script; I know the program is definitely
different than ECMA spec in C.  If it passes ECMAScript conformance, then I'll
publish it and try to get it moved to Mozilla and KJS, as well as developing an
optional platform independent ASP 3.0 interface.
Jul 06 2006
parent reply %u <murpsoft hotmail.com> writes:
Hi guys, just letting you all know that my project, QScript is
still moving along slowly.  I've been bug hunting and optimizing
various things to do with my lexer/parser implementation.  At this
point the input source is consumed (and gc'd) as the lexer scans
over it, and tokens are produced and put in an array in one pass.

The lexer/parser is handling almost everything; it fails on the

'octal, no hex' /039/,
'un-terminated string' /\"\0/,
'regular expressions' /\/[^\/]/

So I'll solve those little glitches tonight and then focus on
establishing flow control by isolating statements and reorganizing
tokens for precedence.
Dec 06 2006
parent Dan Lewis <murpsoft hotmail.com> writes:
Okay, today I managed to get my engine to build token trees using (){}[] instead
of just building giant arrays.  That part is beautiful.  I've yet to get it
handling semicolons/statements, validating sequences, or order of operations;
like most ECMAScript based languages, mine still chokes on Regular Expression

So far, my parser is run from the lexer, not the other way around as is
standard.  : p
Dec 10 2006