Skip to content

Instantly share code, notes, and snippets.

use Grammar::Debugger;
grammar C::CInteger;
token TOP {^ <integer-constant> $}
token integer-constant {
<integer-value> <integer-suffix>*
}
proto token integer-value {*}
token integer-value:sym<8> { <octal-constant> }
「int main(int x) { return x; }」
function-definition => 「int main(int x) { return x; }」
declaration-specifiers => 「int 」
declaration-specifier => 「int 」
type-specifier => 「int 」
sym => 「int」
declarator => 「main(int x) 」
direct-declarator => 「main(int x) 」
direct-declarator-first => 「main」
ident => 「main」
use v6;
module C::CAST;
class TranslationUnit {
has ExternalDeclaration @decls;
}
class ExternalDeclaration {
}
@andydude
andydude / myVisitor.cpp
Created April 25, 2013 00:39
My attempt at adding a function to help with the bubbling phase of walking the AST.
unsigned clang_visitChildrenWithPost(CXCursor parent,
CXCursorVisitor visitor,
CXPostChildrenVisitor post_visitor,
CXClientData client_data) {
clang::cxcursor::CursorVisitor CursorVis(clang_Cursor_getTranslationUnit(parent), visitor, client_data,
/*VisitPreprocessorLast=*/false,
/*VisitIncludedPreprocessingEntries=*/false,
/*RegionOfInterest=*/clang::SourceRange(),
/*VisitDeclsOnly=*/false,
/*PostChildrenVisitor=*/post_visitor);
@andydude
andydude / echo.rs
Last active December 17, 2015 22:38
POSIX echo
fn unwords(args: &[~str]) -> ~str {
return str::connect(args, " ");
}
fn echo(args: &[~str]) {
match args.tail() {
[~"-n", ..strs] => print(unwords(strs)),
strs => println(unwords(strs)),
}
}
@andydude
andydude / wc.rs
Last active December 18, 2015 02:38
POSIX wc (word count)
extern mod extra;
use extra::getopts::*;
pub struct Total {
lines: uint,
words: uint,
chars: uint,
bytes: uint
}
;; Default font
(set-default-font "unifont-16")
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (
:family "unifont"
:background "White"
<div class="panel panel-default main-panel" style="margin-bottom: 0px; height: 700px;">
<div class="panel-body">
<ul class="nav nav-tabs" role="tablist">
<li id="headers-tab" class="active"><a href="#headers" role="tab" data-toggle="tab">Headers</a></li>
<li id="cookies-tab"><a href="#cookies" role="tab" data-toggle="tab">Cookies</a></li>
<li id="params-tab"><a href="#params" role="tab" data-toggle="tab">Params</a></li>
<li id="postData-tab"><a href="#postData" role="tab" data-toggle="tab">PostData</a></li>
<li id="postText-tab"><a href="#postText" role="tab" data-toggle="tab">PostText</a></li>
<li id="response-tab"><a href="#response" role="tab" data-toggle="tab">Response</a></li>
<li id="timing-tab"><a href="#timing" role="tab" data-toggle="tab">Timing</a></li>
def is_alt(side, side2):
side, side2 = side[0], side2[0]
return side == side2
def is_opp(side, side2):
side, side2 = side[0], side2[0]
if ord(side) > ord(side2):
side, side2 = side2, side
if side == 'D' and side2 == 'U':
return True
import six
import pyarrow as pa
import pandas as pd
adr_schema = pa.schema([
pa.field('pobox', pa.string()),
pa.field('street2', pa.string()),
pa.field('street1', pa.string()),
pa.field('city', pa.string()),
pa.field('state', pa.string()),