|
From: | Hans Aberg |
Subject: | Re: semantic actions |
Date: | Thu, 1 Mar 2007 22:15:57 +0100 |
On 1 Mar 2007, at 21:25, Bob Rossi wrote:
This way, invocation can take place as: std::ifstream ifs(...); semantic_value sv; parser p(...); ... ifs >> p >> sv; // Read and parse semantic value which I think is intuitive.Wow, that's a neat trick. I'll keep that in mind!
Yeah, I like it too: it makes the parser to fit into the iostreams manipulator paradigm. Though, if one is using only one invocation of the parser in the program, it perhaps less important.
If the type is known, one can omit the parser in the syntax. I have a parser that manipulates a database. So then the syntax is
my::database db(...); std::ifstream ifs(...); ... ifs >> db; // Let the input parse manipulate the database.If more that one parser can manipulate the database, it would be better to include it, as above.
Hans Aberg
[Prev in Thread] | Current Thread | [Next in Thread] |