In `createSlide`, you have 2 arguments with type varargs[string], because you 
put a comma after `title`. Also `body.sons` is not defined.
    
    
    import macros
    
    proc createSlide(title: string, body: varargs[string]): NimNode =
      result = newEmptyNode()
      echo "createSlide", title, body
    
    proc slideDslImpl(head, body: NimNode): NimNode =
      if body.kind == nnkIdent:
        var args: seq[string]
        for n in body:
          if n.kind == nnkStrLit:
            args.add n.strVal
        result = createSlide(body.strVal, args)
    
    macro slide*(head, body: untyped): untyped =
      result = slideDslImpl(head, body)
      echo result.treeRepr # let us inspect the result
    
    
    Run

Documentation of the macros module: 
[https://nim-lang.org/docs/macros.html](https://nim-lang.org/docs/macros.html)

Reply via email to