Changeset 30713 in project


Ignore:
Timestamp:
04/15/14 23:58:55 (7 years ago)
Author:
Moritz Heidkamp
Message:

comparse: Update link to smug, update copyright year, add some clarifications to introduction

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/comparse

    r30703 r30713  
    77similar to [[http://www.haskell.org/haskellwiki/Parsec|Haskell's
    88Parsec]]. Its implementation is based on
    9 [[http://common-lisp.net/~dcrampsie/smug.html|Drew Crampsie's smug for
    10 Common Lisp]] but slightly deviates in naming and provides a number of
    11 additional convenience combinators.
     9[[https://github.com/drewc/smug|Drew Crampsie's smug for Common Lisp]]
     10but slightly deviates in naming and provides a number of additional
     11convenience combinators.
    1212
    1313
     
    2727''parser combinators'' to create new parsers. In Comparse inputs are
    2828represented by a {{parser-input}} type. It can hold a sequence of any
    29 kinds of ''items'' (often characters). For example:
     29kinds of ''items'' (often characters). For example, we can define an
     30input sequence of characters like this:
    3031
    3132<enscript language="scheme">
     
    4546consumes one item from the given input and returns it as its parse
    4647result. If the input is empty, {{item}} fails. We can apply it to the
    47 input we defined above using the {{parse}} procedure
     48input we defined above using the {{parse}} procedure:
    4849
    4950<enscript language="scheme">
     
    7778  (bind item (lambda (x)
    7879               (lambda (remainder)
     80                 ;; Note that unlike the `parse' procedure, the
     81                 ;; internal parser API does not expect multiple
     82                 ;; return values but rather a pair of values on
     83                 ;; successful parse.
    7984                 (cons (list x x) remainder)))))
    8085
     
    9499touching the remainder is needed quite frequently, Comparse provides
    95100the {{result}} parser combinator which does just that. Using it we can
    96 write {{double-item}} like this:
     101write {{double-item}} more conveniently like this:
    97102
    98103
     
    269274==== License
    270275
    271   Copyright (c) 2013, Moritz Heidkamp
     276  Copyright (c) 2013-2014, Moritz Heidkamp
    272277  All rights reserved.
    273278 
Note: See TracChangeset for help on using the changeset viewer.