Jelle Feringa
2013-11-14 11:22:22 UTC
Hi,
I'm writing a parser for the RAPID robot language.
I'd like to know what is a good way to approach the following
parsing problem. Something specific for RAPID is that
for loops, conditional, function, module definitions
all use a familar MODULE < module block > ENDMODULE
or PROC < procedure block > ENDPROC structure.
My question is what is the right way to go about this?
Here we have an example of a procedure defined in RAPID.
Intuitively I would write a regex that matches the
name of the procedure, its argument and the procedure block.
Another way would be to drop into a state when such a
START / END block is found, but that feels unnecessarily
complex.
PROC top_front( string strNoStepIn )
! procedure block
MoveL ...;
ENDPROC
Since this pattern is so present in the language, I'd like to get it
right and in a p(l)ythonic manner. Thing is that I'm too new to the
parsing to really see that.
Thanks,
-jelle
I'm writing a parser for the RAPID robot language.
I'd like to know what is a good way to approach the following
parsing problem. Something specific for RAPID is that
for loops, conditional, function, module definitions
all use a familar MODULE < module block > ENDMODULE
or PROC < procedure block > ENDPROC structure.
My question is what is the right way to go about this?
Here we have an example of a procedure defined in RAPID.
Intuitively I would write a regex that matches the
name of the procedure, its argument and the procedure block.
Another way would be to drop into a state when such a
START / END block is found, but that feels unnecessarily
complex.
PROC top_front( string strNoStepIn )
! procedure block
MoveL ...;
ENDPROC
Since this pattern is so present in the language, I'd like to get it
right and in a p(l)ythonic manner. Thing is that I'm too new to the
parsing to really see that.
Thanks,
-jelle
--
You received this message because you are subscribed to the Google Groups "ply-hack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ply-hack+***@googlegroups.com.
To post to this group, send email to ply-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ply-hack/loom.20131114T120932-607%40post.gmane.org.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "ply-hack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ply-hack+***@googlegroups.com.
To post to this group, send email to ply-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ply-hack/loom.20131114T120932-607%40post.gmane.org.
For more options, visit https://groups.google.com/groups/opt_out.