[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Flex and Bison C++ Example
From: |
Philip Herron |
Subject: |
Re: Flex and Bison C++ Example |
Date: |
Mon, 08 Mar 2010 14:38:53 +0000 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090817) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Hollencamp wrote:
> I made an example of using Flex and Bison together in C++ and was
> wondering if you guys could provide some feedback. Despite the C++
> interface being 'experimental' I found it works out pretty good
> after you figure it out.
>
> http://www.thewaffleshop.net/2010/03/06/flex-bison-cpp-example/
Hey
Well as far as i can tell, '#pragma once' isn't portable, you should
use inclusion guards for the sake of a little bit of the
c-preprocessor to keep things portable. And really isn't this
syntactic sugar for simply calling yyparse() ? Plus you haven't really
given a way to set the input for the lexer to read. Just usually if
your going down the fully abstracted approach you need the necessary
get/set's to give control to the user so to avoid touching the
implementation code as much as possible.
Though then again i haven't used bison in C++ mode, i wonder can't you
simply use:
- ----
#ifdef __cplusplus
extern "C" {
#endif
<code>
#ifdef __cplusplus
}
#endif
- ----
Though sometimes that can make things messy but it works well for
writing api's that are callable from C++.
- --Phil
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkuVC/sACgkQAhcOgIaQQ2EpXgCdF5JOFPJKMexOa2V4Wp6MYdOe
bcgAn3RJz9yfD1DntXPz0GUPS6TIyPVM
=ae//
-----END PGP SIGNATURE-----