CBMC
mini_c_parser.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Mini C Parser
4 
5 Author: Daniel Kroening, dkr@amazon.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_CRANGLER_MINI_C_PARSER_H
13 #define CPROVER_CRANGLER_MINI_C_PARSER_H
14 
15 #include "ctoken.h"
16 
17 #include <iosfwd>
18 #include <optional>
19 #include <vector>
20 
22 {
23  // could be C++20 std::span to avoid copying
24  using tokenst = std::vector<ctokent>;
25 
30 
31  void print(std::ostream &) const;
32  bool is_function() const;
33  bool has_body() const;
34  std::optional<ctokent> declared_identifier() const;
35 };
36 
37 using c_translation_unitt = std::vector<c_declarationt>;
38 
39 c_translation_unitt parse_c(std::istream &);
40 
41 std::ostream &operator<<(std::ostream &, const c_declarationt &);
42 
43 #endif // CPROVER_CRANGLER_MINI_C_PARSER_H
ctoken
std::ostream & operator<<(std::ostream &, const c_declarationt &)
c_translation_unitt parse_c(std::istream &)
std::vector< c_declarationt > c_translation_unitt
Definition: mini_c_parser.h:37
bool has_body() const
std::optional< ctokent > declared_identifier() const
bool is_function() const
void print(std::ostream &) const
tokenst post_declarator
Definition: mini_c_parser.h:28
tokenst initializer
Definition: mini_c_parser.h:29
tokenst declarator
Definition: mini_c_parser.h:27
tokenst pre_declarator
Definition: mini_c_parser.h:26
std::vector< ctokent > tokenst
Definition: mini_c_parser.h:24