Skip to content

Instantly share code, notes, and snippets.

View whitten's full-sized avatar
💭
Looking at code

David Whitten whitten

💭
Looking at code
View GitHub Profile
@whitten
whitten / languages
Last active August 29, 2015 13:57 — forked from dobau/languages
A Sharp (.NET)|A# .NET
A Sharp (Axiom)|A# (Axiom)
A-0 System
A+ (programming language)|A+
A++
ABAP
ABC (programming language)|ABC
ABC ALGOL
ABLE (programming language)|ABLE
ABSET
@whitten
whitten / c99.l
Last active August 29, 2015 14:08 — forked from codebrainz/c99.l
D [0-9]
L [a-zA-Z_]
H [a-fA-F0-9]
E ([Ee][+-]?{D}+)
P ([Pp][+-]?{D}+)
FS (f|F|l|L)
IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U))
%{
#include <stdio.h>
@whitten
whitten / gist:2808745bbae70af33a7d
Last active August 29, 2015 14:25 — forked from carpeliam/gist:08fad4f02e1d3fa2ef23
This is how to get patient summary details from a node console, similar to the function call at https://github.com/robtweed/ewdGateway2/blob/master/ewdLite/node_modules/VistADemo.js#L81.
// after running `vagrant ssh` to log into VM:
// sudo su - osehra
// cd ewdjs
var ewdGlobals = require('ewdjs/lib/ewdGlobals');
var interface = require('nodem/lib/mumps');
var db = new interface.Gtm();
var util = require('util');
var ok = db.open();
ewdGlobals.init(db);
@whitten
whitten / xml_1_0.marpa.bnf
Last active March 20, 2016 05:24 — forked from jddurand/xml_1_0.marpa.bnf
W3C EBNF to Marpa using Marpa
inaccessible is ok by default
:start ::= document
AttDef ::= S Name S AttType S DefaultDecl
AttDef_any ::= AttDef *
AttType ::= StringType
AttType ::= TokenizedType
AttType ::= EnumeratedType
AttValue ::= _Lex030 _Gen060_any _Lex030
AttValue ::= _Lex032 _Gen063_any _Lex032
#!env perl
use strict;
use diagnostics;
use Marpa::R2;
use Data::Dumper;
use POSIX qw/EXIT_SUCCESS/;
use Data::Section -setup;
use open qw(:std :utf8); # Undeclared streams in UTF-8.
#
@whitten
whitten / _xml_1_0_parseEventsb.c
Created March 20, 2016 05:26 — forked from jddurand/_xml_1_0_parseEventsb.c
_xml_1_0_parseEventsb example
/**************************/
/* _xml_1_0_parseEventsb */
/**************************/
static C_INLINE marpaWrapperBool_t _xml_1_0_parseEventsb(void *datavp, marpaWrapper_t *marpaWrapperp, size_t nEventi, marpaWrapperEvent_t *marpaWrapperEventp) {
marpaWrapperBool_t rcb = MARPAWRAPPER_BOOL_TRUE;
xml_1_0_t *xml_1_0p;
marpaXmlLog_t *marpaXmlLogp = NULL;
xml_1_0_symbol_t symboli;
int i;
@whitten
whitten / number.pl
Created March 20, 2016 05:26 — forked from jddurand/number.pl
MintberryCruNCH question on Marpa IRC
use 5.010;
use strict;
use warnings;
use Data::Dumper;
use Marpa::R2;
my $g = Marpa::R2::Scanless::G->new( {
bless_package => 'main',
@whitten
whitten / EBNF-ISO_IEC_14977_1996_E.pl
Created March 20, 2016 05:27 — forked from jddurand/EBNF-ISO_IEC_14977_1996_E.pl
Marpa grammar of official EBNF ISO/IEC 14977:1996(E)
#!env perl
# -----------------------------------------------------------------------------------------
# Marpa grammar for EBNF published by ISO/IEC 14977:1996(E)
#
# Extensions are minor, and ONLY because our keyboards are more likely to expose Latin-1
# character rather than the Windows-1252 characters as per the spec, i.e.:
#
# Extension 1: Add ' to quoted strings (ISO published the special neighbour character ’)
# Extension 2: Add ^ to <other character> (ISO published the special neighbour character ˆ)
# Extension 3: Add ` to <other character> (ISO published the special neighbour character ‘)
@whitten
whitten / MarpaRulesByDepth.pl
Created March 20, 2016 05:28 — forked from jddurand/MarpaRulesByDepth.pl
Inspect marpa grammar rules by depth
#!env perl
use strict;
use diagnostics;
use Marpa::R2 2.081001;
my $grammar = Marpa::R2::Scanless::G->new({ source => \do {local $/; <DATA>}});
my $fmt = "%5s %-20s %-20s %s\n";
printf $fmt, 'depth', 'ruleName', 'lhsName', 'rhsNames';
foreach (@{rulesByDepth($grammar)}) {
printf $fmt, $_->{depth}, $_->{ruleName}, $_->{lhsName}, join(' ', @{$_->{rhsNames}});
@whitten
whitten / literal.pl
Created March 20, 2016 05:29 — forked from jddurand/literal.pl
Marpa literal() and UTF8 flag
#!env perl
use strict;
use diagnostics;
use Marpa::R2;
use Devel::Peek;
my $grammar_source = do {local $/; <DATA>};
my $input = "\x{2665}";
print "INPUT:\n--------------------\n";
Dump($input);