Interactive metaprogramming shells

Hi, I've built interactive shells for preprocessor and template metaprogramming. I've been using them for development and debugging of metaprograms and I think Boost developers could also find them useful. You can type in (metaprogramming) expressions which get evaluated and the result is displayed immediately. For example you can type boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type and you get boost_::mpl::vector<double, int, char> as the result (the boost_ namespace is used because there are some tricks there to make the output more readable). As an example for the preprocessor shell you can type BOOST_PP_REPEAT(3, foo BOOST_PP_TUPLE_EAT(3), ~) and you get foo foo foo as the result. The tools are based on the Boost.Wave library and Clang. You can get them here: Preshell for preprocessor: https://github.com/sabel83/preshell Metashell for template metaprograms: https://github.com/sabel83/metashell You can also try them from your browser here: http://abel.web.elte.hu/shell Feedback is welcome. Regards, Ábel

I'm probably doing something naively foolish, but your example didn't work for me.
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type <stdin>:6:26: error: use of undeclared identifier 'boost' <stdin>:6:49: error: use of undeclared identifier 'boost' <stdin>:6:71: error: expected '(' for function-style cast or type construction <stdin>:6:78: error: expected unqualified-id
Thx, Rob.

Hi Rob, On 2014-01-26 13:10, Robert Jones wrote:
I'm probably doing something naively foolish, but your example didn't work for me.
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type <stdin>:6:26: error: use of undeclared identifier 'boost' <stdin>:6:49: error: use of undeclared identifier 'boost' <stdin>:6:71: error: expected '(' for function-style cast or type construction <stdin>:6:78: error: expected unqualified-id
You need to include the Boost.MPL headers: #include <boost/mpl/vector.hpp> #include <boost/mpl/push_front.hpp> And to get formatting, the following header as well: #include <metashell/formatter/vector.hpp> And then you can run the example: boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type Regards, Ábel ||

On 01/26/2014 06:16 AM, Abel Sinkovics wrote:
Hi Rob,
On 2014-01-26 13:10, Robert Jones wrote:
I'm probably doing something naively foolish, but your example didn't work for me.
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type <stdin>:6:26: error: use of undeclared identifier 'boost' <stdin>:6:49: error: use of undeclared identifier 'boost' <stdin>:6:71: error: expected '(' for function-style cast or type construction <stdin>:6:78: error: expected unqualified-id
You need to include the Boost.MPL headers:
#include <boost/mpl/vector.hpp> #include <boost/mpl/push_front.hpp>
And to get formatting, the following header as well:
#include <metashell/formatter/vector.hpp>
And then you can run the example:
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type
Regards, Ábel ||
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
How are the include directories specified? IOW, suppose, I've my own boost/mpl/vector.hpp and I want to use that instead of the boost/mpl one. Is there something like the -I flag of gcc which does something analogous for the metashell? TIA. -regards, Larry

On Sun, Dec 28, 2014 at 5:35 PM, Larry Evans <cppljevans@suddenlink.net> wrote:
[...] How are the include directories specified? IOW, suppose, I've my own boost/mpl/vector.hpp and I want to use that instead of the boost/mpl one. Is there something like the -I flag of gcc which does something analogous for the metashell?
TIA.
-regards, Larry
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Hi Larry, You can pass -I <dir> flags to metashell. It will do exactly what you would expect. Regards, András

On 12/28/2014 10:55 AM, András Kucsma wrote:
On Sun, Dec 28, 2014 at 5:35 PM, Larry Evans <cppljevans@suddenlink.net> wrote:
[...] How are the include directories specified? IOW, suppose, I've my own boost/mpl/vector.hpp and I want to use that instead of the boost/mpl one. Is there something like the -I flag of gcc which does something analogous for the metashell?
TIA.
-regards, Larry
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Hi Larry,
You can pass -I <dir> flags to metashell. It will do exactly what you would expect.
Regards, András
Thank you Andras. I tried that, but apparently it was using the wrong std library. I even used the --clang flag to get it too the right clang binary. I used the attached .sh file, but the terminal session was as shown in 2nd attachment. Any ideas how to solve this? -regards, Larry

On Sun, Dec 28, 2014 at 9:19 PM, Larry Evans <cppljevans@suddenlink.net> wrote:
On 12/28/2014 10:55 AM, András Kucsma wrote:
On Sun, Dec 28, 2014 at 5:35 PM, Larry Evans <cppljevans@suddenlink.net> wrote:
[...] How are the include directories specified? IOW, suppose, I've my own boost/mpl/vector.hpp and I want to use that instead of the boost/mpl one. Is there something like the -I flag of gcc which does something analogous for the metashell?
TIA.
-regards, Larry
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Hi Larry,
You can pass -I <dir> flags to metashell. It will do exactly what you would expect.
Regards, András
Thank you Andras.
I tried that, but apparently it was using the wrong std library. I even used the --clang flag to get it too the right clang binary. I used the attached .sh file, but the terminal session was as shown in 2nd attachment.
Any ideas how to solve this?
-regards, Larry
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Hi Larry, I've ran into the same problem several times before. Metashell uses some heuristics to find out where the system headers are, and it's not perfect. The quick workaround is to point Metashell to the directory of the correct stdint.h file which is used by the system compiler by using another "-I" flag. The clang binary passed to the --clang flag is only used to generate precompiled headers to speed up the speed of the interactive evaluation. You generally don't have to specify it explicitly. Metashell ships with a bundled clang binary which will be used by default. I can see that Metashell failed to use your clang binary to generate precompiled headers from the splash text you sent. (But this has nothing to do with the original error you get). Also, if your time allows please open a new issue to the project's github page <https://github.com/sabel83/metashell>, so we can investigate what went wrong with the system headers off the mailing list. Please give information about what version you're using and how did you compile Metashell (if you compiled from source). Thanks! András

On 01/26/14 05:21, Abel Sinkovics wrote:
Hi,
I've built interactive shells for preprocessor and template metaprogramming. I've been using them for development and debugging of metaprograms and I think Boost developers could also find them useful.
You can type in (metaprogramming) expressions which get evaluated and the result is displayed immediately. For example you can type
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type
and you get
boost_::mpl::vector<double, int, char>
as the result (the boost_ namespace is used because there are some tricks there to make the output more readable).
As an example for the preprocessor shell you can type
BOOST_PP_REPEAT(3, foo BOOST_PP_TUPLE_EAT(3), ~)
and you get
foo foo foo
as the result.
The tools are based on the Boost.Wave library and Clang. You can get them here: Preshell for preprocessor: https://github.com/sabel83/preshell Metashell for template metaprograms: https://github.com/sabel83/metashell
You can also try them from your browser here: http://abel.web.elte.hu/shell
Feedback is welcome.
Regards, Ábel
FANTASTIC! I tried the above example in my ubuntu Konqueror browser and it worked as expected: /* * Template metaprogramming shell 1.0.0 * 9f2271f Keep link path at install * * Metashell Copyright (C) 2013 Abel Sinkovics (abel@sinkovics.hu) * This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it * under certain conditions; for details visit <http://www.gnu.org/licenses/>. * * Based on * libclang Debian clang version 3.2-7ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2) * Boost.Wave 2.3.0.4421 [linux/GNU C++ version 4.8.1] * Readline 6.2 */
#include <boost/mpl/vector.hpp>
#include <boost/mpl/push_front.hpp>
#include <metashell/formatter/vector.hpp>
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type
boost_::mpl::vector<double, int, char>
Thank you very much Abel. -kind regards, Larry

I've built interactive shells for preprocessor and template metaprogramming. I've been using them for development and debugging of metaprograms and I think Boost developers could also find them useful.
You can type in (metaprogramming) expressions which get evaluated and the result is displayed immediately. For example you can type
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type
and you get
boost_::mpl::vector<double, int, char>
as the result (the boost_ namespace is used because there are some tricks there to make the output more readable).
As an example for the preprocessor shell you can type
BOOST_PP_REPEAT(3, foo BOOST_PP_TUPLE_EAT(3), ~)
and you get
foo foo foo
as the result.
The tools are based on the Boost.Wave library and Clang. You can get them here: Preshell for preprocessor: https://github.com/sabel83/preshell Metashell for template metaprograms: https://github.com/sabel83/metashell
You can also try them from your browser here: http://abel.web.elte.hu/shell
That's nice tools! However, the wave tool itself already supports a REPL interface for preprocessing, just start it without arguments... Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu

On 1/26/2014 4:24 PM, Hartmut Kaiser wrote:
I've built interactive shells for preprocessor and template metaprogramming. I've been using them for development and debugging of metaprograms and I think Boost developers could also find them useful.
You can type in (metaprogramming) expressions which get evaluated and the result is displayed immediately. For example you can type
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type
and you get
boost_::mpl::vector<double, int, char>
as the result (the boost_ namespace is used because there are some tricks there to make the output more readable).
As an example for the preprocessor shell you can type
BOOST_PP_REPEAT(3, foo BOOST_PP_TUPLE_EAT(3), ~)
and you get
foo foo foo
as the result.
The tools are based on the Boost.Wave library and Clang. You can get them here: Preshell for preprocessor: https://github.com/sabel83/preshell Metashell for template metaprograms: https://github.com/sabel83/metashell
You can also try them from your browser here: http://abel.web.elte.hu/shell
That's nice tools! However, the wave tool itself already supports a REPL interface for preprocessing, just start it without arguments...
Is there any documentation for this interface ? I could not find anything about it in "The Wave Driver" documentation.

I've built interactive shells for preprocessor and template metaprogramming. I've been using them for development and debugging of metaprograms and I think Boost developers could also find them useful.
You can type in (metaprogramming) expressions which get evaluated and the result is displayed immediately. For example you can type
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type
and you get
boost_::mpl::vector<double, int, char>
as the result (the boost_ namespace is used because there are some tricks there to make the output more readable).
As an example for the preprocessor shell you can type
BOOST_PP_REPEAT(3, foo BOOST_PP_TUPLE_EAT(3), ~)
and you get
foo foo foo
as the result.
The tools are based on the Boost.Wave library and Clang. You can get them here: Preshell for preprocessor: https://github.com/sabel83/preshell Metashell for template metaprograms: https://github.com/sabel83/metashell
You can also try them from your browser here: http://abel.web.elte.hu/shell
That's nice tools! However, the wave tool itself already supports a REPL interface for preprocessing, just start it without arguments...
Is there any documentation for this interface ? I could not find anything about it in "The Wave Driver" documentation.
What documentation would you like to see? It's as simple as starting the driver without command line arguments. Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu

On 1/26/2014 7:08 PM, Hartmut Kaiser wrote:
I've built interactive shells for preprocessor and template metaprogramming. I've been using them for development and debugging of metaprograms and I think Boost developers could also find them useful.
You can type in (metaprogramming) expressions which get evaluated and the result is displayed immediately. For example you can type
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type
and you get
boost_::mpl::vector<double, int, char>
as the result (the boost_ namespace is used because there are some tricks there to make the output more readable).
As an example for the preprocessor shell you can type
BOOST_PP_REPEAT(3, foo BOOST_PP_TUPLE_EAT(3), ~)
and you get
foo foo foo
as the result.
The tools are based on the Boost.Wave library and Clang. You can get them here: Preshell for preprocessor: https://github.com/sabel83/preshell Metashell for template metaprograms: https://github.com/sabel83/metashell
You can also try them from your browser here: http://abel.web.elte.hu/shell
That's nice tools! However, the wave tool itself already supports a REPL interface for preprocessing, just start it without arguments...
Is there any documentation for this interface ? I could not find anything about it in "The Wave Driver" documentation.
What documentation would you like to see? It's as simple as starting the driver without command line arguments.
What am I supposed to be entering in order to see how the driver expands a macro ? Do I enter macro definitions and/or #include statements followed by a macro invocation ?

That's nice tools! However, the wave tool itself already supports a REPL interface for preprocessing, just start it without arguments...
Is there any documentation for this interface ? I could not find anything about it in "The Wave Driver" documentation.
What documentation would you like to see? It's as simple as starting the driver without command line arguments.
What am I supposed to be entering in order to see how the driver expands a macro ? Do I enter macro definitions and/or #include statements followed by a macro invocation ?
Exactly. Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu

Hi Hartmut, On 2014-01-26 22:24, Hartmut Kaiser wrote:
That's nice tools! However, the wave tool itself already supports a REPL interface for preprocessing, just start it without arguments...
Preshell provides convenience features. It provides features like history, tab completion, pragmas to list defined macros, etc. It also supports getting the standard header path from the real C++ compiler (and getting one as the default is part of the build process). And I'm working on features like saving the history into a file or reloading the headers. I couldn't get these features from the wave tool. Merging these things into the wave tool might be an option. Regards, Ábel

On 2014-01-26 22:24, Hartmut Kaiser wrote:
That's nice tools! However, the wave tool itself already supports a REPL interface for preprocessing, just start it without arguments...
Preshell provides convenience features. It provides features like history, tab completion, pragmas to list defined macros, etc. It also supports getting the standard header path from the real C++ compiler (and getting one as the default is part of the build process). And I'm working on features like saving the history into a file or reloading the headers. I couldn't get these features from the wave tool.
Merging these things into the wave tool might be an option.
That would be very nice! Especially adding the ability to use the setting from a real compiler would be very helpful. Wave supports serializing all internal settings using Boost.Serialization, if enabled (wave::context is serializable). That stores all macros, seen headers with #pragma once, etc. which essentially allows to restore a previous session. Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu

On 1/26/2014 6:21 AM, Abel Sinkovics wrote:
Hi,
I've built interactive shells for preprocessor and template metaprogramming. I've been using them for development and debugging of metaprograms and I think Boost developers could also find them useful.
You can type in (metaprogramming) expressions which get evaluated and the result is displayed immediately. For example you can type
boost::mpl::push_front<boost::mpl::vector<int, char>, double>::type
and you get
boost_::mpl::vector<double, int, char>
as the result (the boost_ namespace is used because there are some tricks there to make the output more readable).
As an example for the preprocessor shell you can type
BOOST_PP_REPEAT(3, foo BOOST_PP_TUPLE_EAT(3), ~)
and you get
foo foo foo
as the result.
The tools are based on the Boost.Wave library and Clang. You can get them here: Preshell for preprocessor: https://github.com/sabel83/preshell Metashell for template metaprograms: https://github.com/sabel83/metashell
You can also try them from your browser here: http://abel.web.elte.hu/shell
Feedback is welcome.
Can the preshell run under Windows ? If so, how do I set it up ? I do have a readline5.dll under Windows as part of the gnuwin32 toolset.

Hi Edward, On 2014-01-26 23:16, Edward Diener wrote:
Can the preshell run under Windows ? If so, how do I set it up ? I do have a readline5.dll under Windows as part of the gnuwin32 toolset.
A few parts of the code needs to be ported to Windows, which is something I am planning to do, but is not done yet. To the best of my knowledge all dependencies are available on Windows. Regards, Ábel
participants (6)
-
Abel Sinkovics
-
András Kucsma
-
Edward Diener
-
Hartmut Kaiser
-
Larry Evans
-
Robert Jones