P4C
The P4 Compiler
Loading...
Searching...
No Matches
p4tools/modules/smith/common/parser.h
1#ifndef BACKENDS_P4TOOLS_MODULES_SMITH_COMMON_PARSER_H_
2#define BACKENDS_P4TOOLS_MODULES_SMITH_COMMON_PARSER_H_
3
4#include "backends/p4tools/modules/smith/common/generator.h"
5#include "ir/indexed_vector.h"
6#include "ir/ir.h"
7#include "ir/vector.h"
8#include "lib/cstring.h"
9
10namespace P4::P4Tools::P4Smith {
11
12class ParserGenerator : public Generator {
13 private:
15
16 public:
17 virtual ~ParserGenerator() = default;
18 explicit ParserGenerator(const SmithTarget &target) : Generator(target) {}
19
20 virtual IR::MethodCallStatement *genHdrExtract(IR::Member *pkt_call, IR::Expression *mem);
21 virtual void genHdrUnionExtract(IR::IndexedVector<IR::StatOrDecl> &components,
22 const IR::Type_HeaderUnion *hdru, IR::ArrayIndex *arr_ind,
23 IR::Member *pkt_call);
24 virtual IR::ListExpression *buildMatchExpr(IR::Vector<IR::Type> types);
25 virtual IR::ParserState *genStartState();
26 virtual IR::ParserState *genHdrStates();
27 virtual void genState(cstring name);
28 virtual void buildParserTree();
29
30 [[nodiscard]] IR::IndexedVector<IR::ParserState> getStates() const { return state_list; }
31};
32
33} // namespace P4::P4Tools::P4Smith
34
35#endif /* BACKENDS_P4TOOLS_MODULES_SMITH_COMMON_PARSER_H_ */
Definition node.h:52
Definition vector.h:59
Definition generator.h:10
Definition p4tools/modules/smith/common/parser.h:12
Definition p4tools/modules/smith/core/target.h:17
Definition cstring.h:85