Skip to content

Instantly share code, notes, and snippets.

View delonnewman's full-sized avatar

Delon R. Newman delonnewman

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
// We'll have 128 tokens. Each token can be up to 32 characters long.
char token[128][32];
int lexer(char* input) {
require 'stringio'
require 'erb'
class Event
end
class MorphList
include Enumerable
def self.empty
grammar Namespace {
token TOP { <ns-form>
# <clojure-forms>
}
# token clojure-forms { }
token ns-form { <.ws>?
(<.comment-line> <ws>?)*
<.ws>?
@alabamenhu
alabamenhu / Grammar proposal.md
Last active November 21, 2021 15:32
Grammar proposal

This is designed to be a working proposal. Comments/corrections/suggestions are welcome, as the first draft was written fairly hastily. I'm working on doing a rough implementation to play around with, beginning with the Binex proposal, which can be found here. It is not currently a full implementation of this proposal, but progressing rapidly.

Background

Grammars in Raku are awesome, and allow for some truly amazing text parsing.
Unfortunately, they are less than ideal for binary files, and there is no way to have them support matching objects, both of which would be very useful (image being able to pattern match on an AST!) This requires writing complex and/or error prone workaround code.

Goal

@icculus
icculus / main.rb
Created March 23, 2020 20:44
Tetris in DragonRuby, code at the end of Part 1
# This is the code as it stands at the end of
# "Let's make Tetris with DragonRuby Game Toolkit!" Part 1:
# https://www.youtube.com/watch?v=xZMwRSbC4rY
$gtk.reset
class TetrisGame
def initialize args
@args = args
@next_move = 30
@devinprater
devinprater / emacspeak-mac.md
Last active February 7, 2024 12:04
Using Emacs, and Emacspeak, on Mac

Emacs, with Emacspeak, on macOS

This guide will, through open source collaboration, spell checking, and Doctor Pepper, show users of Apple (Mac) computers how to install Emacs, Emacspeak, and link the two together for an enjoyable text editing experience, and if there is enough Doctor Pepper, how to best use the included Emacs modes for greater productivity than is provided by newer software. There

@reborg
reborg / rich-already-answered-that.md
Last active February 23, 2024 13:09
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

if (__DEV__) {
window.devtoolsFormatters = window.devtoolsFormatters || [];
window.devtoolsFormatters.push((function() {
/* mori's type check methods */
var checks = [
'isReduceable', 'isSeqable',
'isReversible', 'isCounted', 'isIndexed',
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active March 29, 2024 19:56
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@creaktive
creaktive / yada-crawler.pl
Last active May 7, 2021 10:24
Simple web crawler/scraper implemented using Web::Scraper & YADA
#!/usr/bin/env perl
use 5.016;
use common::sense;
use utf8::all;
# Use fast binary libraries
use EV;
use Web::Scraper::LibXML;
use YADA 0.039;