Snippets tagged parsing

  • Parsing string expressions, the lazy way

    Sometimes you'd be surprised at what functionality you can find inside the .Net framework. Apparently the DataTable object can compute string expressions. Nice for testing your own parser implementation, and/or for lazy coders like me. Note that the DataTable is created only once and reused with each function call.

    34 people like this

    Posted: 8 years ago by Arjen Kopinga

  • Uri Parser

    A Uri parser using the Cashel library [1]. This implementation is using ArraySegment as the underlying state, as I'm using it within a server, but it would be trivial to switch it to using a list. Also, note that I am not parsing the Uri into any specific structure, though that, too, would be trivial. For my current purposes, I just needed to validate the Uri. [1] https://github.com/panesofglass/cashel

    26 people like this

    Posted: 8 years ago by Ryan Riley

  • Yet another command-line parser

    The snippet shows a parser for command-line arguments supporting value lists for single commands. Calling with the following arguments: "Arg 1" "Arg 2" -test "Case 1" "Case 2" -show -skip "tag" produces the following map: map [("", seq ["Arg 1"; "Arg 2"]); ("show", seq []); ("skip", seq ["tag"]);("test", seq ["Case 1"; "Case 2"])] which can be used to find what data have been sent along with different commands. Calling with the following: "Arg 1" "Arg 2" /test="Case 1" "Case 2" --show /skip:tag produces the same result.

    5 people like this

    Posted: 7 years ago by Gennady Loskutov

  • JSON parsing with monads

    JSON parsing with monads. See also "Expression parsing with monads" (http://fssnip.net/bi). Author URL: http://www.zbray.com

    8 people like this

    Posted: 7 years ago by Zach Bray

  • Parse locale files

    This uses fparsec to parse locale files of hte form Id = text {arg:type} = newline = newlne For use with localization.

    1 people like this

    Posted: 6 years ago by devshorts

  • Extract script blocks from html page (FP)

    A bit more functional version of this: http://fssnip.net/iR

    2 people like this

    Posted: 5 years ago by @kot_2010

  • A minimalist XML Parser

    A minimalist XML Parser

    10 people like this

    Posted: 5 years ago by Fabio Galuppo

  • KataBankOCR

    See: http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR Prog. F# 2013 - London

    2 people like this

    Posted: 5 years ago by Zach Bray

  • A Simple Parser

    This is a basic parser that I wrote which takes heavily from the examples in Dom Syme's Expert F# book and http://fsharpforfunandprofit.com/posts/pattern-matching-command-line/

    3 people like this

    Posted: 4 years ago by Joe C

  • Simple AST parser

    Parsers a minimal expression tree allowing for functions of the form "func(arg1,arg2,...)->{body}"

    4 people like this

    Posted: 2 years ago by devshorts

  • Small Basic Parser

    Small Basic abstract syntax tree, parser and interpreter. Supports Small Basic's keywords and arithmetic, logical and comparison operators.

    6 people like this

    Posted: 1 year ago by Phillip Trelford

  • Simple FParsec int32 parser

    Like FParsec's pint32, but accepts only optionally-signed base-10 input

    1 people like this

    Posted: 4 months ago by Mark Laws

  • Functional wrappers for TryParse APIs

    Exemplary convenience wrappers for some of the System..TryParse APIs, using the combined power of F#' return value deconstruction mechanism via pattern matching, active patterns and option types instead of "out/ref" parameters. Added support for newest versions of F# to determine which overload of TryParse should be used.

    6 people like this

    Posted: 1 month ago by Novox