A readline C and C++ REPL with history, tab-completion, and undo.
gcc
(GNU C Compiler)readline
Console display librarylibelf
ELF access library
./cepl [-hptvw] [-c<compiler>] [-e<code to evaluate>] [-f<file> ] [-l<library>] [-I<include directory>] [-o<out.c>]
Run make
then ./cepl
to start the interactive REPL.
To install after building, set the environment variables DESTDIR
and PREFIX
if needed, then run make install
:
PREFIX=/usr make install
to install everything to /usr
.
The following environment variables are respected: CFLAGS
, LDFLAGS
,
LDLIBS
, and LIBS
.
Command history is read from and saved to ~/.cepl_history
.
To switch between C/C++ modes, specify your C or C++ compiler
with -c
such as:
cepl -cg++ -lboost_filesystem -lboost_context -lboost_system
to run in C++ mode linking against Boost and compiling with g++, or:
cepl -cclang -lelf -oout.c
to run in C mode linking against libelf and compiling with clang, saving
your code to out.c
on exit.
-c, --compiler Specify alternate compiler
-e, --eval Evaluate the following argument as C/C++ code
-f, --file Source file to import
-h, --help Show help/usage information
-o, --output Name of the file to output C/C++ code to
-p, --parse Disable addition of dynamic library symbols to readline completion
-t, --tracking Toggle variable tracking
-v, --version Show version information
-w, --warnings Compile with "-Wall -Wextra -pedantic" flags
-l Link against specified library (flag can be repeated)
-I Search directory for header files (flag can be repeated)
;h[elp] Show help
;m[acro] Define a macro (e.g. ";m #define SWAP2(X) ((((X) >> 8) & 0xff) | (((X) & 0xff) << 8))")
;o[utput] Toggle -o (output C source code) flag
;p[arse] Toggle -p (shared library parsing) flag
;q[uit] Exit CEPL
;r[eset] Reset CEPL to its initial program state
;t[racking] Toggle variable tracking
;u[ndo] Incremental undo (can be repeated)
;w[arnings] Toggle -w (pedantic warnings) flag
- libelf
- libreadline