On 4 October 2010 17:06, Philip Herron <redbr...@gcc.gnu.org> 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 _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison