Skip to content

Instantly share code, notes, and snippets.

View marionette-of-u's full-sized avatar

arithmeticae marionette-of-u

View GitHub Profile
#include <unistd.h>
#include <netdb.h>
#include <dirent.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <utility>
#include <iterator>
#include <string>
#include <memory>
#include <stdexcept>
#include <sstream>
// incrementation when check.
#define UTF8_ITERATOR_CHECK_FORM_IN_INC
#define PUSH_BACK(z, n, elem) rhs.push_back(BOOST_PP_SEQ_ELEM(n, elem));
#define DECL(l, seq, sa) \
{ \
scanner_type::expression_type::rhs_type rhs; \
BOOST_PP_REPEAT(BOOST_PP_SEQ_SIZE(seq), PUSH_BACK, seq); \
rhs.semantic.action = &semantic_action::sa; \
l.rhs.insert(rhs); \
}
#define WRAPPED_DECL_SEQ(z, n, elem) \
DECL( \
DECL_SEQS(IdentifierSeq,((identifier)(SymbolType_opt.lhs))(identifier_seq_a)((IdentifierSeq.lhs)(comma)(identifier)(
SymbolType_opt.lhs))(identifier_seq_b));DECL_SEQS(NonDelimIdentifierSeq,((identifier)(ReferenceSpecifier_opt.lhs))(m
ake_non_delim_identifier_seq_a)((NonDelimIdentifierSeq.lhs)(identifier)(ReferenceSpecifier_opt.lhs))(make_non_delim_
identifier_seq_b)((ReferenceSpecifier.lhs))(make_non_delim_identifier_seq_c));DECL_SEQS(Type,((DoubleColon_opt.lhs)(
NonDelimIdentifierSeq.lhs)(Template_opt.lhs)(NestIdentifier_opt.lhs))(make_type_a)((Type.lhs)(NonDelimIdentifierSeq.
lhs))(make_type_b));DECL_SEQS(ReferenceSpecifier,((asterisk))(make_reference_specifier)((ampersand))(make_reference_
specifier));DECL_SEQS_EPS(ReferenceSpecifier_opt,((ReferenceSpecifier.lhs))(make_reference_specifier_opt));DECL_SEQS
_EPS(DoubleColon_opt,((double_colon))(make_double_colon_opt));DECL_SEQS_EPS(NestIdentifier_opt,((NestIdentifier.lhs)
)(make_nest_identifier_opt));DECL_SEQS(NestIdentifier,((double_colon)(identifier)(Templa
foreach rule in R ...a
foreach subtree in rule
(* overlapping *)
rule の meta-variable を meta-prime-variable へ全てスイッチし, rule' とする
rule' に対して subtree で overlapping
(* `most-general-unifier' builder *)
result := meta-variable に対応する subtree' in rule' を match で取得する
if result.fail then
goto (a)
// 簡単な Knuth–Bendix completion algorithm の実装例
#include <list>
#include <map>
#include <set>
#include <memory>
#include <utility>
#include <string>
#include <numeric>
#include <iostream>
// 簡単な Knuth–Bendix completion algorithm の実装例
#include <vector>
#include <map>
#include <set>
#include <utility>
namespace keisan_calc{
// 木.
template <class value_type>
#include <iostream>
#include <cmath>
template<int N, int M>
struct matrix{
static const int n = N;
static const int m = M;
double data[N * M];
matrix(){
/!
{@・<>・@}
/~ ~/
/, ,/
=====>=>====
(0)
tielでの第1級オブジェクト
lambda, value, symbol, tuple, algebraic-data-type (and constructor), list.
#include <iostream>
#include <functional>
#include <typeinfo>
#include <cxxabi.h>
template<int ID>
struct any{
static const int id = ID;
};