:: Re: [DNG] Studying C as told. (For …
Etusivu
Poista viesti
Vastaa
Lähettäjä: KatolaZ
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] Studying C as told. (For help)
On Wed, Jul 06, 2016 at 08:54:12AM +0200, Edward Bartolo wrote:
> Hi,
>
> It seems the interest to give me feedback about what I am studying and
> coding is dwindling rapidly. Nevertheless, I am coding a parser in C.
> I have already coded the tokeniser and tested it. Next, I will
> dedicate my efforts to the actual parsing. I am writing a syntax
> checker for simple boolean expressions as an EXERCISE.
>
> Thankfully, the world does have other people who are willing to
> positively criticise and actually help me in my endeavour to REVISE C,
> for I have already studied it some years ago.
>
> I am attaching my little project code. (parser.c)
>
> Edward



Even for didactical purposes, I would never start writing a parser in
C from scratch. You should use lex and yacc for that, unless your
language is a very simple regular language (e.g., no balanced
parentheses). The handling of context-free languages and LALR(1)
grammars is not straightforward and will almost certainly lead to
useless frustration, which you might not want to go through even if
you work as a language designer to bring bread on your table.

Parsing context-free grammars and has nothing to do with learning or
revising C, IMHO. My advice remain the same: code a simple shell, and
you will learn a lot more.

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  ]