Skip to content

Instantly share code, notes, and snippets.

// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_macro("cond", cond);
}
fn cond<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<base::MacResult + 'cx> {
let output = cond_rec(TokenStream::from_tts(tts.clone().to_owned()));
build_emitter(cx, sp, output)
}
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_macro("cond", cond);
}
fn cond<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<base::MacResult + 'cx> {
let output = cond_rec(TokenStream::from_tts(tts.clone().to_owned()));
build_emitter(cx, sp, output)
}
// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

Quasiquotation for Rust Macros

Following Scheme, we'll provide a handful of operators to programmers to help them easily construct new syntactic forms (ie, output tokenstreams). These forms include:

  • quote!, for quickly creating new syntactic forms/tokenstreams
  • unquote, which escapes quote (following , from Scheme's quasiquote form), allowing users to perform general computation inside of a quote! invocation.
  • unquote-splice, which escapes quasi-quoting and then list-splices the result into the quasi-syntax term.
@cgswords
cgswords / ccon.rkt
Created September 30, 2015 17:30
Strange construction in Redex, the generated examples produce a funny error.
#lang racket
(require redex)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; LANGUAGE
(define-language ccon
(x y f ::= variable-not-otherwise-mentioned)
(n ::= integer)

Where does the game take place?

The game takes place in one of the large, ruined cities of the world.

  • The city is ruined in "patches": some were burned down, some taken over by the weird, some destroyed in riots maybe? Nature reclaimed some, some is maybe weirdly missing.
  • Coastal city
  • One or two major rivers, mostly frozen solid
  • Sliced up into different turfs held by different people
  • There are underground tunnels in the city (who lives there?)