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: 13 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: 13 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.

    6 people like this

    Posted: 12 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: 11 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: 10 years ago by devshorts

  • Log file parsing

    File parsing, based on multiple lines, using recursive pattern matching with many :: (cons) operator

    2 people like this

    Posted: 10 years ago by Tuomas Hietanen

  • Log file parser for log4Net files

    Log file parser for log4Net files

    3 people like this

    Posted: 10 years ago by Tuomas Hietanen

  • 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: 9 years ago by Joe C

  • Simple AST parser

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

    5 people like this

    Posted: 6 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.

    8 people like this

    Posted: 6 years 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: 5 years 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.

    22 people like this

    Posted: 4 years ago by Novox

  • 10 PRINT CHR$(205.5+RND(1)); : GOTO 10

    Inspired by https://10print.org, this is a small incomplete BASIC interpreter that can generate a maze.

    5 people like this

    Posted: 3 years ago by Tomas Petricek

  • Parse bindingRedirects with Linq2Xml

    Find binding-redirects with linq-to-xml from a .config file. This might be useful for then parsing config-changes e.g. by System.Linq.Enumerable.Except

    4 people like this

    Posted: 1 year ago by Tuomas Hietanen