After David's answer, do you recall what lead to your confusion on
how wisent worked? Is there something obvious we could do to prevent
this confusion for the next person?
Well, as I recently noted there is at least one thing that I'm still
confused about, and that is: what is the correct way to produce
output from the parsing system.
David suggested writing my wisent input in the following style:
;; For use with Semantic, must return valid semantic tags!
expr
: ;; empty
| symbol
(TAG "expr" 'expr :value $1)
| symbol PLUS symbol
(TAG "expr" 'expr :value (concat $1 $2 $3))
;
But in wisent-java.wy I see things like
type_parameters
: LT type_parameter_list_1
(progn $2)
;
type_parameter_list
: type_parameter_list COMMA type_parameter
(cons $3 $1)
| type_parameter
(list $1)
;
Similarly, but more dramatically, wisent-calc.wy actually does the
computations that the user types in!
So my question is - what is the correct protocol to use for
producing output from the parser? Recall that my goal is to use
wisent to transform code for another programming language (Tiger)
into Elisp. (It might be fun to make the language work with
semantic, but that is not a high priority goal for me at this time
-- not for this particular language anyway.)
Other than this question, I think my first point of confusion was
that I thought that if the user (me) didn't supply a lexer, then
some default lexer would be used. That apparently was just
incorrect. Another question would be, why is wisent better to use
as a parser than bovine? (Maybe the full answer is more technical
than I really need to know, but I'm still interested to know
something about this question.)
I think my confusion would be massively reduced, if not prevented
altogether, by documentation that contains a step-by-step guide
(tutorial, maybe) for such things as writing a working wisent
parsing system and getting this system to work with semantic.
I would definitely be willing to help write this documentation if
you like -- but since I'm still riding the learning curve, I'm not
sure if that would be the best thing to do. Still, I'd be happy
to contribute my code (once it is working), and that might be helpful
to others.
To sum up: as always, more thorough documentation almost always
reduces confusion!
|