Hey all,
I'm new to Spirit and trying to put a parser together for a very simple
language of S expressions. [Note: while I'm new to Spirit, I'm not new
to parsers or parser combinators.]
This is sort of an obnoxious email because it's basically "here, solve
my problem for me even though I haven't read the docs as well as I
could", but I figured I'd ask anyway; so if you take a look, I'm much
appreciative.
I define some tokens
template <typename Lexer>
struct tokens : lex::lexer<Lexer> {
tokens() {
this->self.add
("(", Tokens::L_Paren)
(")", Tokens::R_Paren)
("\"...\"", Tokens::String_Literal)
("[0-9]+", Tokens::Integer_Literal)
("[a-zA-Z]+", Tokens::Symbol)
;
}
};
Then a grammar:
template <typename Iterator>
struct sexp_grammar
: qi::grammar