All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Gerards <metgerards@student.han.nl>
To: grub-devel@gnu.org
Subject: Bison error handling
Date: Wed, 02 Nov 2005 19:25:46 +0100	[thread overview]
Message-ID: <87acgmhpp1.fsf@student.han.nl> (raw)

Hi,

Hopefully any of you have either a clue about bison or an idea how to
solve this problem.

What happens now is that during parsing memory is allocated.  If
everything is parsed there is a set of malloc'ed memory all pointing
to each other, etc.

The main problem is in case of a syntax error.  In that case all of
the state should be released (free all memory structures).  But I have
no idea how to do that;  yyparse just returns an error.  I need a way
to make bison return a valid structure so I can check if parsing
failed and release all of the memory.

One solution to this problem is making a big list of all memory
allocated while scanning and parsing.  When parsing fails you just
free all of this memory.  Otherwise everything is freed when the
datastructures are about to be de-allocated.

But I prefer a solution using bison stuff, otherwise I'll just use the
solution I described above.

--
Marco




             reply	other threads:[~2005-11-02 18:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-02 18:25 Marco Gerards [this message]
2005-11-02 19:22 ` Bison error handling Marco Gerards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87acgmhpp1.fsf@student.han.nl \
    --to=metgerards@student.han.nl \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.