Walnut

Alan Knowles alan at akbkhome.com
Tue Jan 1 05:24:03 PST 2008


Dan wrote:
> Hi guys,
> 
> I've been working on the Walnut project for a while now by myself, and it's got one major component remaining before the alpha debugging can start going down - the parser.
> 
> http://dsource.org/projects/walnut/browser/branches/1.9/
> 
> The code seems pretty elegant so far, and it should be easy enough to read.  I recommend starting in Value.d, but I'm sure there are lots of things I've done wrong while programming it.  I was hoping I could convince some people to take a look at it and point out my mistakes.
> 
As you've opened the door - please regard the below as my personal 
opinon, and take as such... ;)

Value.d:
You have made quite heavy use of op*** magic methods, Having done this 
before a few times, it always bites me in the ass later on.. - as you 
have to remember what magic is going to occur when you assign/create.

It may be better to switch to more obvious/classic methods, - overloaded 
constructors or an overloaded static method "construct()", / 
to[typename], index(int id) etc.
= This is going to make the future code alot easier to read, and 
understand. (along with maintain, enable others to quickly work out what 
is going on )

structure.d:
I would be tempted to create a method to generate this type of code, 
rather than trying to create a solution(the op*** stuff) for a problem 
that would not have existed if you had gone down the road of using code 
generators..
Have a look at this to get an idea..
http://www.akbkhome.com/svn/gtkDS/wrap/APILookupPhobos.txt

text.d:
some of this could be autogenerated, and enum'd (might be clearer)
eg...  TEXT.undefined

methods.d:
again, using a code generator would give you benefit's of documentation 
and using static D classes to encapsulate each Javascript class (along 
with making smaller more manageable files..)

Not sure why your standard method call is using varargs (...) - unless I 
misread the code..

------------
interpreter.d
(might be better to rename it tokenizer.d)

Looks like the next big jobs would be:
finish tokenizing (and do some test cases)
creating the OPcodes.... (this part looks painful and time-consuming, 
having seen dmdscript version. - parser / expression / statement etc.)

Scope Management?
Opcode runtime (~2800 lines of code in dmdscript)

---
Unfortunately I detest forum's - old school (or stuborn), i prefer good 
ole mailing lists (which I have for most D newsgroups, as I pull the 
nntp feed into my mailbox)

I'm keeping an eye on Walnut, but I since most of my needs for 
Javascript/DMDscript mean getting results very quickly from hacks to 
DMDscript, I cant really justify to much real help to Walnut 
unfortunately - but do keep working on it, as soon as the opcode 
runtime, parser/opcode builder are done, I'd be pretty keen to retarget 
all the binding code for DMDscript to be Walnut only.


Regards
Alan







> I'm going to be studying how to use Trac today, so if you'd be so kind, please use the forums for now.
> 
> Much appreciated,
> Regards,
> Dan
> 


More information about the Digitalmars-d-learn mailing list