yacc

astropy.utils.parsing.yacc(tabmodule, package)[source]

Create a parser from local variables.

It automatically compiles the parser in optimized mode, writing to tabmodule in the same directory as the calling file.

This function is thread-safe, and the returned parser is also thread-safe, provided that it does not share a lexer with any other parser.

It is only intended to work with parsers defined within the calling function, rather than at class or module scope.

Parameters:
tabmodulepython:str

Name for the file to write with the generated tables, if it does not already exist (without .py suffix).

packagepython:str

Name of a test package which should be run with pytest to regenerate the output file. This is inserted into a comment in the generated file.