ACSE 2.0.2
Advanced Compiler System for Education (basic documentation)
Loading...
Searching...
No Matches
Error Management

Utilities for reporting compilation errors. More...

Data Structures

struct  t_fileLocation
 Structure that represents a location in a file. More...
 

Functions

void emitError (t_fileLocation loc, const char *fmt,...)
 
void fatalError (const char *fmt,...) __attribute__((noreturn))
 
void yyerror (const char *msg)
 

Variables

int numErrors
 The number of errors logged by emitError up to now.
 

Detailed Description

Utilities for reporting compilation errors.

These functions are used to report errors during compilation. In the parser it is also possible to use yyerror() for the same purpose.


Data Structure Documentation

◆ t_fileLocation

struct t_fileLocation

Structure that represents a location in a file.

Definition at line 19 of file errors.h.

Data Fields
char * file The name of the file.
int row The zero-based index of a line in the file.

Function Documentation

◆ emitError()

void emitError ( t_fileLocation loc,
const char * fmt,
... )

Prints an error message depending on the given code. Does not terminate the program.

Parameters
locThe file location where the error originated, or ‘nullFileLocation’ if not applicable
fmtA printf-like format string.

◆ fatalError()

void fatalError ( const char * fmt,
... )

Prints the specified error message and terminates the program.

Parameters
fmtA printf-like format string.

◆ yyerror()

void yyerror ( const char * msg)

Report a syntax error.

Note
This function is also used by Bison-generated code.
Parameters
msgThe error message.

Variable Documentation

◆ numErrors

int numErrors
extern

The number of errors logged by emitError up to now.