Giter VIP home page Giter VIP logo

alice's Introduction

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.

alice's People

Contributors

bitfis avatar hriener avatar marcelwa avatar msoeken avatar ruanformigoni avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.