This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
puts("Hello, world!\n"); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(cellular_automata). | |
-compile(export_all). | |
make_rule(N) -> | |
<<B1:1, B2:1, B3:1, B4:1, B5:1, B6:1, B7:1, B8:1>> = <<N>>, | |
fun({X1, X2, X3}) -> | |
<<Idx>> = <<0:5, X1:1, X2:1, X3:1>>, | |
lists:nth(Idx+1, [B8,B7,B6,B5,B4,B3,B2,B1]) | |
end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
struct node { | |
int data; | |
struct node *next; | |
}; | |
int main(void) { | |
struct node a, b, c, d; | |
a.next = &b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open util/ordering[Node] | |
sig Node { | |
lhs : lone Node, | |
rhs : lone Node | |
} | |
fact { | |
// 葉をたどればすべての要素が取得できるrootがただひとつ存在する | |
one root : Node | Node = root.*(lhs+rhs) | |
// 任意の節において成り立つ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract sig Expr { | |
lhs : lone Expr, | |
rhs : lone Expr | |
} | |
sig True extends Expr {} | |
sig False extends Expr {} | |
sig Not extends Expr {} | |
sig And extends Expr {} | |
sig Or extends Expr {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expr : primitive | <'+', expr, expr> | <'-', expr, expr> | |
primitive : NUMBER | |
equal(e1:NUMBER, e2:NUMBER) -> | |
e1 == e2 | |
equal(<'+', e1l, e1r>, <'+', erl, e2r>) -> | |
equal(e1l, e2l) && equal(e1r, e2r) | |
equal(<'-', e1l, e1r>, <'-', erl, e2r>) -> | |
equal(e1l, e2l) && equal(e1r, e2r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <stdbool.h> | |
#include "aatree.h" | |
static aanode* new_aanode(const int key, void *val, aanode *nullnode) { | |
aanode *n = (aanode*)malloc(sizeof(aanode)); | |
if(n == NULL) return NULL; | |
n->key = key; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
typedef enum { | |
ATOMIC, | |
NOT, | |
AND, | |
OR, | |
IMPLIES, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
using namespace std; | |
typedef enum { | |
IMPLIES, | |
AND, | |
OR, | |
NOT, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/regex.hpp> | |
int main() | |
{ | |
std::string file_path = "/foo/bar/bunny.obj"; | |
std::string type = "unknown"; | |
boost::regex rx_find_extension("^.*\\.(\\w+)$"); | |
boost::smatch result; | |
if ( boost::regex_match( file_path, result, rx_find_extension ) ) |