Re: compiler with non-deterministic grammar

Scott Stanchfield <>
8 May 1997 01:04:43 -0400

          From comp.compilers

Related articles
compiler with non-deterministic grammar (Wei-cheng Lai) (1997-05-03)
Re: compiler with non-deterministic grammar (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) (1997-05-15)
Re: compiler with non-deterministic grammar (1997-05-17)
| List of all articles for this month |

From: Scott Stanchfield <>
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


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.