pepper package¶
Submodules¶
pepper.preprocessor¶
This module contains the functions necessary to run only the preprocessor
It primarily serves as the entry point to Pepper
pepper.symbol_table¶
The Symbol Table module implements a class to track declarations and usages of identifiers
-
pepper.symbol_table.
FILE_STACK
= []¶ The stack of files we’re reading from
-
pepper.symbol_table.
IFDEF_STACK
= []¶ The stack of ifdef/ifndef/if control structures we’re processing
-
pepper.symbol_table.
LINUX_DEFAULTS
= ['/usr/include/c++/7', '/usr/include/x86_64-linux-gnu/c++/7', '/usr/include/c++/7/backward', '/usr/lib/gcc/x86_64-linux-gnu/7/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed', '/usr/include/x86_64-linux-gnu', '/usr/include']¶ The default linux paths to search for includes-
-
class
pepper.symbol_table.
MacroExpansion
(name, expansion, args=None)[source]¶ Bases:
object
Expands an identifier into a macro expansion, possibly with arguments
-
pepper.symbol_table.
SYSTEM_INCLUDE_PATHS
= ['/usr/include/c++/7', '/usr/include/x86_64-linux-gnu/c++/7', '/usr/include/c++/7/backward', '/usr/lib/gcc/x86_64-linux-gnu/7/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed', '/usr/include/x86_64-linux-gnu', '/usr/include']¶ The list of paths to search when doing a system include
-
pepper.symbol_table.
TABLE
= {}¶ The global symboltable
-
pepper.symbol_table.
TRIGGER_INTERNAL_ERROR
= False¶ Switch to test internal error handling
pepper.abstract_symbol_tree module¶
This is the abstract symbol tree for PEPPr.
The parser will build the actual tree, so this is really more of a library of nodes that may be used within the tree.
pepper.lexer module¶
This is the lexer for PEPPr
It’s responsible for tokenizing the incoming character stream. The Parser will ingest the token stream and build a tree, which will in turn produce actual c++ or c code.
-
pepper.lexer.
lex
(lines, debug_mode=False)[source]¶ Takes a single string, containing newlines, that’s the entire input
pepper.parser module¶
This is the Parser module for Pepper
This module impelements the grammar for the preprocessor language, comprised of tokens from the Lexer module. This module implements a main function, but this is only for debugging and will be removed on release.
-
pepper.parser.
p_define_expression_no_args
(p)[source]¶ define_expression : PREPROCESSING_KEYWORD_DEFINE WHITESPACE IDENTIFIER WHITESPACE macro_expansion
-
pepper.parser.
p_define_expression_no_expansion
(p)[source]¶ define_expression : PREPROCESSING_KEYWORD_DEFINE WHITESPACE IDENTIFIER
-
pepper.parser.
p_define_expression_some_args
(p)[source]¶ define_expression : PREPROCESSING_KEYWORD_DEFINE WHITESPACE IDENTIFIER ‘(‘ identifier_list ‘)’ maybe_space macro_expansion
-
pepper.parser.
p_expression_list_multiple
(p)[source]¶ list_of_expressions : list_of_expressions ‘,’ safe_code_expressions
-
pepper.parser.
p_expression_to_list_of_something
(p)[source]¶ code_expression_parenthetical : ‘(‘ list_of_expressions ‘)’
-
pepper.parser.
p_identifier_call
(p)[source]¶ safe_code_expression : IDENTIFIER code_expression_parenthetical
-
pepper.parser.
p_identifier_list_multiple
(p)[source]¶ identifier_list : identifier_list ‘,’ maybe_space IDENTIFIER
-
pepper.parser.
p_ifdef_expression
(p)[source]¶ ifdef_expression : PREPROCESSING_KEYWORD_IFDEF WHITESPACE IDENTIFIER
-
pepper.parser.
p_ifndef_expression
(p)[source]¶ ifndef_expression : PREPROCESSING_KEYWORD_IFNDEF WHITESPACE IDENTIFIER
-
pepper.parser.
p_include_expression
(p)[source]¶ - preprocessor_expression : include_expression
- define_expressionifdef_expressionifndef_expressionendif_expressionelse_expression
-
pepper.parser.
p_include_expression_disambiguation
(p)[source]¶ - include_expression : include_expression_file
- include_expression_system
-
pepper.parser.
p_include_expression_file
(p)[source]¶ include_expression_file : PREPROCESSING_KEYWORD_INCLUDE WHITESPACE STRING_LITERAL
-
pepper.parser.
p_include_expression_system
(p)[source]¶ include_expression_system : PREPROCESSING_KEYWORD_INCLUDE WHITESPACE SYSTEM_INCLUDE_LITERAL
-
pepper.parser.
p_safe_code_expression_to_parens
(p)[source]¶ safe_code_expression : code_expression_parenthetical
-
pepper.parser.
p_safe_code_expressions_ascii_literal
(p)[source]¶ - safe_code_expression : ‘<’
- ‘>’‘+’‘-‘‘%’‘^’‘&’‘*’‘{‘‘}’‘[‘‘]’‘=’‘;’‘:’‘#’‘.’‘?’‘~’
-
pepper.parser.
p_safe_expressions
(p)[source]¶ safe_code_expressions : safe_code_expressions safe_code_expression