Skip to content

Instantly share code, notes, and snippets.

public interface IConstraint<T>
{
bool Satisfies(T value);
}
public class Constrained<T, Constraint>
where Constraint : IConstraint<T>, new()
{
public static bool TryCreate(T val, out Constrained<T, Constraint> result)
{
var c = new Constraint();
public static class Option
{
public static Option<T> Some<T>(T item)
=> new Option<T>(item);
public static Option<T> None<T>()
=> new Option<T>();
}
public struct Option<T>
{
private readonly T value;

In this tutorial we're going to build a set of parser combinators.

What is a parser combinator?

We'll answer the above question in 2 steps.

  1. What is a parser?
  2. and, what is a parser combinator?

So first question: What is parser?

@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>