help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grammar problem


From: Philip Herron
Subject: Re: Grammar problem
Date: Mon, 4 Oct 2010 17:38:39 +0100

On 4 October 2010 17:06, Philip Herron <address@hidden> wrote:
> Hey
>
> This i am having trouble trying to think what the grammar would look
> like. Say i had the language:
>
> 10
> 1100
> 111000
>
> How would i represent that in a grammar?
>
> I've been thinking something like:
>
> S->0S0
>   | B
>
> B-> lambda
>  | 1B
>
> From one of my old grammars but that generates 010  or 00100 etc..
> just having trouble getting my head into gear today! :)
>
> --Phil
>

Figured out my problem sorry for wasted post just didn't have my
morning coffee today :) It works as so:

S-> lambda
     | 0S1

So it generates nothing or: 10 or 1100 or 111000.

Writing a grammar for this toy language someone thought up looks lots
like modula where you have the procedure declarations the the var
declarations then your blocks etc...

--Phil

--Phil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]