> 
> I have a question for those of you who are familiar with lex and yacc.
> Obviously, if the literal strings "|", "^", etc. are treated as
> otherwise uninterpreted tokens, an HL7 v2 message cannot be parsed with
> any context free grammar, but if after reading the first 5 characters,
> we make them the tokens FIELD_SEP, COMP_SEP, etc., then token stream
> can easily be parsed with a CFG. But is it possible to use a tool like
> lex (of flex) to implement a scanner for HL7 messages? I can't thtink
> of any way of doing this. I know yacc can be used with hand coded
> scanners, but scanning the message is already 80% of the work!


To my knowledge, you could do what you are suggesting. Tokenizing in
Yacc/Bison is of course, tricky.  I assume you are talking about HL7 2.0
since HL7 3.0 is supposed to be a subset of XML (according to what I read).

You will probably have to "un-tokenize" in cases where the first 5
characters appear in comments, which is reasonable. Just as a warning
of the wierdness you get when you have "flexible" token to character
associations.

Another possibility would be to use Terence Parr's ANTLR
(http://www.antlr.org/)  which allows for grammars for the scanner as well
as a grammar for the parser.

Best Regards,
David

> 
> =====
> A practical man is a man who practices the errors of his forefathers. 
> --Benjamin Disraeli
> ====
> Greg Woodhouse 
> [EMAIL PROTECTED] 
> [EMAIL PROTECTED] 
> 
> 
> 
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Hardhats-members mailing list
> Hardhats-members@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hardhats-members
> 



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to