Interesting. Unfortunately I have never tried parser generators myself. For my 
simple use cases Nim's parseutils or strscan was not that bad. Or npegs. In the 
book I have an example like
    
    
    import std/strscans
    
    proc sep(input: string; start: int; seps: set[char] = {' ',',',';'}): int =
      while start + result < input.len and input[start + result] in {' ','\t'}:
        inc(result)
      if start + result < input.len and input[start + result] in {';',','}:
        inc(result)
      while start + result < input.len and input[start + result] in {' ','\t'}:
        inc(result)
    
    proc stt(input: string; strVal: var string; start: int; n: int): int =
      if input[start .. start + "Rect".high] == "Rect":
        strVal = "Rect"
        result = "Rect".len
    
    var x1, y1, x2, y2: float
    var name: string
    
    let input = "Rect 10.0    ;20.0,100  ,  200"
    
    if scanf(input, "${stt(0)}$s$f$[sep]$f$[sep]$f$[sep]$f", name, x1, y1, x2, 
y2):
      echo name, ' ', x1, ' ', y1, ' ', x2, ' ', y2 # Rect 10.0 20.0 100.0 200.0
    
    
    Run

Similar code I us a lot myself. Would you suggest using your parlexgen instead, 
and may you be able to provide an example that does the same as above code with 
your parlexgen?

Reply via email to