maaany output

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

maaany output

Jens Kallup
Hello,

I have this code:
http://coliru.stacked-crooked.com/a/41a3464aff344a1a

It produce me veeeryyy looongg error messages with the Gnu g++ 6.3.0.
What is wrong on it?

I can't check against other, because:
local, i get errors, and on culiru a timeout.

TIA for helping
Jens


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: maaany output

Jens Kallup
Hello Seth,

I would like parse the commands:

"SET LANG de en"

without the qoutes ""
The parser should use no_case, if possible.
lang, de, and en should be symbols with _not speciefed_ length;
so they should dynamic.
Then, the parser should call a function, which handle the 3
symbols.

Hope I could describe corectly
Jens


Am 21.07.2017 um 02:23 schrieb Seth:
> You could state what your goal is, and we could start from scratch.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: maaany output

sehe
In reply to this post by Jens Kallup
On 18-07-17 10:24, Jens Kallup wrote:
> I can't check against other, because:
> local, i get errors, and on culiru a timeout.

You can read the errors. That's a start.

And if you don't understand, you can always begin by reducing the amount
of unneeded code, and comment out things until it starts compiling.

There's not even a sample input?

Too many things can't possibly compile. And then there is the number of
issues (like mutual implicit conversions leading to inevitable infinite
recursion in ast_print (ast_print doesn't know how to print `nil` or
`std::string`); like the global variable `dast` that somehow gets set
only from inside ast_print, but ironically is also passed to ast_print
exclusively; the fact that you litter the grammer with `*comment` when
all you really want (likely) is to always ignore comment tokens; The
fact that you write `"qi::_1"` when likely you mean either `qi::_1` or
`std::string("something")`; the fact that there is a ~80 line `mystream`
class floating around in that mess without any particular purpose; ditto
for `ast_struct`; not even mentioning `std::cout <<
"lllllllllllllllllllllllllll";` randomly in a function; ).

You could state what your goal is, and we could start from scratch.

$0.02

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: maaany output

sehe
In reply to this post by Jens Kallup
On 21-07-17 07:24, Jens Kallup wrote:
>
> "SET LANG de en"
>
> without the qoutes ""
> The parser should use no_case, if possible.
> lang, de, and en should be symbols with _not speciefed_ length;
> so they should dynamic.
> Then, the parser should call a function, which handle the 3
> symbols.

Here you go http://coliru.stacked-crooked.com/a/903160f45ed784bd

If the number of arguments is hard coded,
http://coliru.stacked-crooked.com/a/a01b9a3992018c9e

If there are other commands, Nabialek trick:
http://coliru.stacked-crooked.com/a/362620c1cc943d8e

If there are specific options, two possibilities:

  - using symbols again (note case insenstivity)
http://coliru.stacked-crooked.com/a/2a350bfc042bd1df

  - checking dynamically in the handler function(s) (you do
case-sensitivity) http://coliru.stacked-crooked.com/a/08aa6f7488f24fab

I've contributed more traditional/full blown parsers for script command
languages on Stackoverflow:

 -
https://stackoverflow.com/questions/14548592/boost-spirit-implement-small-one-line-dsl-on-a-server-application/14554966

 -
https://stackoverflow.com/questions/7893768/using-boostbind-with-boostfunction-retrieve-binded-variable-type/7897417#7897417

 -
https://stackoverflow.com/questions/44255761/parsing-a-command-language-using-boost-spirit/44261883#44261883

 -
https://stackoverflow.com/questions/18048928/c-splitting-a-string-into-strings-and-ints/18049073#18049073

 -
https://stackoverflow.com/questions/41187486/what-is-the-c-way-of-handling-a-framework-to-call-functions-of-different-types/41188557#41188557



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general