lilt icon indicating copy to clipboard operation
lilt copied to clipboard

Add full example (including nim code) to docs

Open auxym opened this issue 5 years ago • 3 comments

My impression after reading the docs is that the grammar is very well explained. However, between "Example" and "Usage", I'm left a little confused at how to actually integrate lilt in a Nim program.

I think it would be nice if the example page had an actual nim snippet like the following:

import lilt

const grammar =  """
digit: <1234567890>
number: wholes=*digit ?["." decimals=+digit]
"""

let parsers = makeParsers grammar

let code = "12.3"

# I'm confused where to go from now, to obtain a LiltValue from our code string...

BTW, I'm very new at playing with parser generators and parsing in general, I'm just exploring nim and parsing for curiosity, and lilt seemed interesting. Sorry if this is obvious to everyone but me...

auxym avatar Dec 01 '18 22:12 auxym