[DGD]parse_string

Erlend M. Simonsen erlends at fairplay.no
Sun Apr 4 01:35:50 CEST 1999


I've been spending some time this easter trying to get my MudOS-like
parser using parse_string() up and running. And I'm ALMOST happy with
it. I've run into two problems, which I thought I'd see if any of you
had an answer to.

1. 
When trying to get an object from a container I have the problem that
when my find_object() function is called, I have no idea which
environment to look for the object in. And I can't just scan all
containers in the environment looking for the object, since I might
end up with the wrong object if several instances of it is present.

I've been able to work around this due to a 'fortunate' parsing order
in parse_string(). It seems like parse_string() goes right to left,
which means it finds the correct container first, which I can remember 
until I go looking for the object. It sounds a bit 'hackish' to me,
and I would like to do this the proper way.

2.  I want to call can_get_obj_from_obj() and the like. The problem I
am having here is that I know nothing about the rule that is matched,
so I build the function name by checking the type of each element in
the result from parse_string(). Which basically breaks all STR
(string) parts of the rules. 

What I tried doing when building the function to call, is to treat all
strings as 'str', but that gives me function names like
can_buy_str_str_liv(), and that doesn't look too nice. I would rather
have it look like is can_buy_str_from_liv(). Anyone have solved this
problem and would like to share with me how they did it?

I don't think I understand the parse_string() grammar 100%, but I have 
it mostly working, and I love the options this new parser gives me. It 
is MUCH better than the one I implemented myself. 

get the small yellow stone from the large blue chest

I love it. 

So, anyone feel up to the task of enlightening me? ;-)

Fudge at Gurba
-- 
Erlend M. Simonsen / Fairplay International AS
erlesimo at online.no / erlends at fairplay.no

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list