Skip to content

Intent Goal

Aniruddha. A edited this page Jan 30, 2017 · 3 revisions

The intent

To create a simple and maintainable yang recognizer[1] and validator using Lua.

  • I wanted an integrated scanner and parser
  • I didn't want to go with traditional LALR(1)
  • LL(k) is good, but I didn't find any good tool other than ANTLR (which leans towards java!)
  • GLR is good too, but I didn't find enough documentation on bisons GLR extensions and usage
  • peg/leg was my original choice, but after a few weeks of trial, discarded it, in favor of LPeg
  • LPeg is cool ;-)

[1] I am deliberately avoiding the term parser because this is not a parser in the traditional sense. This recognizes a yang like structure (block/nesting) using LPeg, and then rules are applied to make sure that its still valid.

Present state

  • Can recognize/match yangs in the wild. Have run this on close to 200 yangs (~32KLOC).
  • Rules to make sure yangs are valid (based on RFC6020)
  • Debug (dump) and indenter included (FWIW).
  • _filter_s can be applied at indent+dump (can cleanup/comment-out etc)
  • A basic auto-completion CLI using linenoise

Next

  • Persist data read from CLI (Lua tables?)
  • Support augment statements
Clone this wiki locally