C++ command shell library
Switch branches/tags
Nothing to show
Clone or download
Latest commit b1f4dbc Sep 2, 2018
Permalink
Failed to load latest commit information.
docs Docs. Sep 2, 2018
examples Show statistics for all store entries. May 28, 2018
include Fix warnings. Sep 2, 2018
lib Fix warnings and errors. Jul 11, 2018
test AppVeyor. Jun 8, 2018
tools C library interface. Mar 4, 2018
.clang-format Clang Format. Jun 9, 2018
.gitignore Ignore files. Dec 6, 2017
.gitmodules Remove catch2 submodule. Dec 30, 2017
.travis.yml Travis. Jan 7, 2018
CMakeLists.txt Windows integration. Jun 9, 2018
LICENSE Readme and license. Dec 6, 2017
README.md AppVeyor. Jun 9, 2018
alice.svg Logo. Dec 7, 2017
appveyor.yml AppVeyor. Jun 8, 2018

README.md

Build Status Build Status Documentation Status License: MIT

alice

alice is a C++-14 command shell library that supports automatic Python bindings. It offers a simple yet feature-rich embedded DSL to create shell interfaces with user-defined commands that access and manipulate arbitrary user-defined data types. Here is a small example for a shell to manipulate `string` objects.

Read the full documentation.

#include <alice/alice.hpp>

#include <algorithm>
#include <iostream>
#include <string>

namespace alice
{

ALICE_ADD_STORE(std::string, "str", "s", "String", "Strings")

ALICE_PRINT_STORE(std::string, os, element)
{
  os << element << std::endl;
}

ALICE_COMMAND(hello, "Generation", "adds a welcome string to the store")
{
  auto& strings = store<std::string>();
  strings.extend() = "hello world";
}

ALICE_COMMAND(upper, "Manipulation", "changes string to upper bound")
{
  auto& str = store<std::string>().current();
  std::transform( str.begin(), str.end(), str.begin(), ::toupper );
}

}

ALICE_MAIN(demo)

After compiling we obtain a shell program with commands that allow us to do the following:

demo> hello
demo> print -s
hello world
demo> hello
demo> upper
demo> print -s
HELLO WORLD
demo> current -s 0
demo> print -s
hello world
demo> quit

We can use the very same code to compile it into a Python library instead of an executable, allowing us to call the commands as Python methods. For example:

import demo

demo.hello()
demo.upper()
demo.print(str = True)

EPFL logic sythesis libraries

alice is part of the EPFL logic synthesis libraries. The other libraries and several examples on how to use and integrate the libraries can be found in the logic synthesis tool showcase.