Skip to content

Instantly share code, notes, and snippets.

@jsuereth
Last active August 29, 2015 14:04
Show Gist options
  • Save jsuereth/03b4cd4b04f7bef550a1 to your computer and use it in GitHub Desktop.
Save jsuereth/03b4cd4b04f7bef550a1 to your computer and use it in GitHub Desktop.
DOGE lambda language

Lambda DOGE

A really dumb idea put into an even dumber spec.

Notes: Grammar is probably ambiguous. Too lazy to actually implement right now, but was playing with syntactic ideas to stay true to the Meme AND to lambda calculus.

Basic Grammar

Any whitespace acts as a token delimiter.

type-declr := SUCH <type>*
arg-list := SO <id>*
let-expr :=  WOW <id> <type-declr>? <arg-list>? (<application-expr>)
application-expr := (MANY | VERY | MUCH) <application> !
expr := (<let-expr> | <application-expr> | <literal> | <id>)

Examples:

WOW
Big
SUCH Int
SO numbers
MUCH Plus numbers 1 !

WOW
Doge
MUCH 5 !

WOW
main
MUCH PrintLn
VERY Big Doge !!

Semantics:

let Big(numbers: Int) = (<Plus> <numbers> 1)
let Doge() = <5>
let main() = (<PrintLn> (<Big> <Doge>))

Expected output:

6

Semantics

The entirety of the program is evaluating the main expression definition.

TODO - Waste more of your life

Type Inference

TODO - Waste a ton of your life.

@jsuereth
Copy link
Author

jsuereth commented Aug 5, 2014

Wow, macros would be amazing, @FranklinChen. A fun idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment