:: Re: [DNG] Studying C as told. (For …
Forside
Slet denne besked
Besvar denne besked
Skribent: Hendrik Boom
Dato:  
Til: dng
Emne: Re: [DNG] Studying C as told. (For help)
On Fri, Jul 08, 2016 at 07:03:36AM +0100, KatolaZ wrote:
> On Fri, Jul 08, 2016 at 06:26:35AM +0200, Edward Bartolo wrote:
> > Hi,
> >
> > Since any grammar item has boundaries it makes sense for a syntax
> > checker to pass boundaries to syntax checking functions. The first
> > step would be to check the existence of an opening bracket and a
> > closing bracket. If more brackets follow the process should be
> > repeated.
> >
> > I think, this strategy should solve the problem with having multiple brackets.
> >
>
> Have you actually tried to implement that in your parser?
>
> I am not asking because I want to be pedantic, but rather because this
> is usually where parsing context-free languages becomes an enormous
> error-prone mess, and is the reason why we have tools like lex/flex
> and yacc/bison which take care of constructing the parser associated
> to a set of productions on your behalf.


It is precisely where recursive descent becomes a really easy wy of
writing a parser. This isn't a difficult language to hand-write a
parser for. Look up "recursive descent parsing" in the Wikipedia, and
you'll see how easy it is:

https://en.wikipedia.org/wiki/Recursive_descent_parser

-- hendrik

>
> My2Cents
>
> KatolaZ
>
> -- 
> [ ~.,_  Enzo Nicosia aka KatolaZ - GLUGCT -- Freaknet Medialab  ]  
> [     "+.  katolaz [at] freaknet.org --- katolaz [at] yahoo.it  ]
> [       @)   http://kalos.mine.nu ---  Devuan GNU + Linux User  ]
> [     @@)  http://maths.qmul.ac.uk/~vnicosia --  GPG: 0B5F062F  ] 
> [ (@@@)  Twitter: @KatolaZ - skype: katolaz -- github: KatolaZ  ]
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng