Related articles |
---|
compiler with non-deterministic grammar wlai@mail.utexas.edu (Wei-cheng Lai) (1997-05-03) |
Re: compiler with non-deterministic grammar thetick@scruz.net (Scott Stanchfield) (1997-05-08) |
Re: compiler with non-deterministic grammar eserra@svmp01.Harris.COM (Efren Serra) (1997-05-13) |
Re: compiler with non-deterministic grammar Sandeep.dutta@mpct.com (Sandeep Dutta) (1997-05-15) |
Re: compiler with non-deterministic grammar adrian@dcs.rhbnc.ac.uk (1997-05-17) |
From: | Scott Stanchfield <thetick@scruz.net> |
Newsgroups: | comp.compilers |
Date: | 8 May 1997 01:04:43 -0400 |
Organization: | scruz-net |
References: | 97-05-014 |
Keywords: | parse |
Not sure why you want it, but...
You could try a compiler that provides semantic predicates (such as
PCCTS) and make the predicates perform the probability check. For
example (PCCTS 1.33 syntax)
rule: <<rollTheD100() < 50>>? alt1
| alt2
;
would execute function rollTheD100() (A 100-sided die...) and test if
the result were less than 50. alt1 would be attempted if:
the semantic test were true (value < 50) AND
the next token were in first(alt1)
otherwise, alt2 would be attempted IF the next token were in first(alt2)
otherwise, syntax error
Is this this type of thing you're looking for?
(I'd be interested in hearing what type of application this type of
parser has... please post something about it if you can...)
-- Scott
Wei-cheng Lai wrote:
> Does anybody know how to construct a compiler with
> non-deterministic grammar? I means that the grammars may contain some
> probability within it. The same sentence might be compiled in
> different way based on some sort of probability. Could you also tell
> me what are good references?
>
> BTW, is it too wierd to have some kind of adaptive compiler such that
> it can modify its grammar along the way?
--
Scott Stanchfield Santa Cruz,CA
Visit my PCCTS Tutorial at http://www.scruz.net/~thetick/pcctstut
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.