ua: User-Agent parser in Go

Design The UA detection algorithm is a pipeline containing 3 steps: Scan: scan products and its corresponding comments from a UA string. Parse: parse device info from products. Detect: detect device model by looking up in a database and get related info, e.g. screen resolution. Scan The scanner scans the user agent string into products. Each product has its own name, version and comments. e.g. For user agent string: Mozilla/5.0 (Linux; U; Android ROM v3; en-us; ALCATEL ONE TOUCH 991 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Its products are: ...

July 18, 2016

JSON Schema parser & code generator

json-schema generates Go struct from a JSON Schema specification. Decimal types are supported for accurate currency calculation.

November 4, 2015

Gombi: Creating Your Own Parser is Easier than Regular Expressions

Gombi is a combinator-style scanner & parser library written in Go. It is practical, reasonably fast and extremely easy to use. Quick start go get -u h12.io/gombi Design Combinator parsers are straightforward to construct, modular and easily maintainable, compared to parser generators like Lex/Yacc. Internal DSL no additional code generation and compilation. Composable a subset of the syntax tree is also a parser. a language can be easily embedded into another one. Gombi is inspired by but not limited to parser combinators. Unlike a combinator parser, Gombi neither limits its API to functional only, nor limits its implementation to functional combinators. Go is not a pure functional language as Haskell, so cloning a combinator parser like Parsec to Go will only lead to an implementaion much worse than Parsec. Instead, Gombi is free to choose any Go language structures that are suitable for a modular and convenient API, and any algorithms that can be efficiently implemented in Go. ...

August 7, 2014

xsd: XML tagged struct generator for Go

xsd is a Go package that generates tagged struct from XML Schema (xsd). When only the XML file is available, an xsd file can be automatically generated by a XML Schema learner, such as “github.com/kore/XML-Schema-learner”.

January 1, 2014