Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #163683

Re: Am I writing C wrong?

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Am I writing C wrong?
Date 2021-11-26 11:18 +0000
Organization A noiseless patient Spider
Message-ID <877dcvcgha.fsf@bsb.me.uk> (permalink)
References <f1ea6843-cddb-4824-b154-2580fd288407n@googlegroups.com> <snksv9$16c$1@dont-email.me> <sno3q2$tcr$1@solani.org> <87r1b4cns2.fsf@bsb.me.uk> <90334f9d-5c53-4a7f-8362-5bdc7155e357n@googlegroups.com>

Show all headers | View raw


luser droog <luser.droog@gmail.com> writes:

> On Thursday, November 25, 2021 at 8:28:56 AM UTC-6, Ben Bacarisse wrote:
>> Philipp Klaus Krause <p...@spth.de> writes: 
>> 
>> > Am 24.11.21 um 09:26 schrieb David Brown: 
>> > 
>> >> And if this is all for fun and interest, then the main concern should be 
>> >> finding which parts of the whole concept are of most interest to you, 
>> >> and picking a language that lets you concentrate on that part, and 
>> >> handles everything lower level automatically. 
>> > 
>> > Note that there are also tools, like lex and yacc, that will handle the 
>> > parts that are hard to do in C for you, and can be used together with 
>> > your C code for the other tasks.
>> True, but I don't think the objective is to parse anything in
>> > articular
particular!
>> but to develop a parsing toolkit based, as closely as C will reasonably 
>> permit, on the combiner model that is popular in functional
combinator!
>> > languages.

> Yes, no precise goals beyond that except vague dreams of using this
> toolkit to write an LCC for the next millennium. A C compiler so amazingly
> concise and readable to invite and facilitate further extensions and 
> experimentation.

C's grammar is not particularly regular.  That part will always be a bit
messy.

> But, if I lean too far in the traditional C direction, then
> there's already https://github.com/orangeduck/mpc
>
> So, I was leaning into the functional side to try to be different.

But, since C is resolutely procedural, that's a rather artificial
challenge.  A clear, easily modifiable C parser, written in C, does not
have to use mocked-up combinators.

> As a more specific symptom, though. I wrote that C comment remover
> with a hefty pinch of lisp-alike gymnastics.

One person's elegant gymnastics is another person's painful contortions!

>   https://codereview.stackexchange.com/questions/254005/removing-c-comments-from-source
>
> And maybe I ought to at least try to re-write it to be more like a
> normal C programmer would do it. With a string buffer type or
> something.  Something other than cons chains.
>
> I really like having the main() code read nicely like a high level
> pseudocode.  But maybe I can achieve that without the tag unions.

The C I write is influenced by my experience with functional languages
but it's mostly superficial because C does not have the fundamental
types needed.

-- 
Ben.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Am I writing C wrong? luser droog <luser.droog@gmail.com> - 2021-11-23 18:48 -0800
  Re: Am I writing C wrong? David Brown <david.brown@hesbynett.no> - 2021-11-24 09:26 +0100
    Re: Am I writing C wrong? Philipp Klaus Krause <pkk@spth.de> - 2021-11-25 14:41 +0100
      Re: Am I writing C wrong? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-11-25 14:28 +0000
        Re: Am I writing C wrong? luser droog <luser.droog@gmail.com> - 2021-11-25 19:18 -0800
          Re: Am I writing C wrong? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-11-26 11:18 +0000
  Re: Am I writing C wrong? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-10 01:11 -0800
    Re: Am I writing C wrong? luser droog <luser.droog@gmail.com> - 2021-12-10 15:02 -0800
      Re: Am I writing C wrong? luser droog <luser.droog@gmail.com> - 2021-12-10 21:00 -0800
  Re: Am I writing C wrong? Dave Dunfield <dave.dunfield@gmail.com> - 2021-12-10 20:11 -0800
    Re: Am I writing C wrong? luser droog <luser.droog@gmail.com> - 2021-12-10 20:47 -0800
    Re: Am I writing C wrong? Bart <bc@freeuk.com> - 2021-12-11 11:45 +0000
      Re: Am I writing C wrong? Dave Dunfield <dave.dunfield@gmail.com> - 2021-12-11 14:00 -0800

csiph-web