Name

tdfc2pragma — tdfc #pragma syntax

#pragma directive syntax

The following gives a summary of the syntax for the #pragma directives used for compiler configuration and token specification:

pragma-directive :
	# pragma TenDRA ++? tendra-directive
	# pragma token-directive

tendra-directive :
	scope-directive
	low-level-directive
	analysis-directive on
	check-directive allow
	keyword-directive
	type-directive
	linkage-directive
	misc-directive
	tendra-token-directive

on :
	on
	warning
	off

allow :
	allow
	warning
	disallow


scope-directive :
	begin
	begin name environment identifier
	end
	directory identifier use environment identifier
	use environment identifier
	use environment identifier reset allow


low-level-directive :
	error string-literal allow
	error string-literal on
	error string-literal as option string-literal
	option string-literal allow
	option string-literal on
	option value string-literal integer-literal
	use error string-literal


analysis-directive :
	complete initialization analysis
	complete struct / union analysis
	conversion analysis conversion-spec?
	discard analysis discard-spec?
	enum switch analysis
	external function linkage
	for initialization block
	ignore struct / union / enum tag
	implicit export template
	implicit function declaration
	integer operator analysis
	integer overflow analysis
	nested comment analysis
	operator precedence analysis
	pointer operator analysis
	throw analysis
	unify external linkage
	variable analysis
	variable hiding analysis
	weak prototype analysis

conversion-spec :
	( int - int implicit-spec? )
	( int - pointer implicit-spec? )
	( pointer - int implicit-spec? )
	( pointer - pointer implicit-spec? )
	( int - enum implicit )
	( pointer - void * implicit )
	( void * - pointer implicit )

implicit-spec :
	implicit
	explicit

discard-spec :
	( function return )
	( static )
	( value )


check-directive :
	ambiguous overload resolution
	assignment as bool
	bitfield overflow
	block function static
	catch all
	character escape overflow
	compatible token
	complete file includes
	conditional declaration
	conditional lvalue
	conditional overload resolution overload-spec?
	const conditional
	directive as macro argument
	dollar as ident
	extra ,
	extra ;
	extra ; after conditional
	extra ...
	extra bitfield int type
	extra macro definition
	extra type definition
	fall into case
	forward enum declaration
	function pointer as pointer
	ident ...
	implicit int type inttype-spec?
	implicit token definition
	incompatible interface declaration
	incompatible member declaration
	incompatible linkage
	incompatible promoted function argument
	incompatible type qualifier
	incompatible void return
	incomplete type as object type
	indented # directive
	indented directive after #
	initialization of struct / union ( auto )
	longlong type
	no directive / nline after ident
	no external declaration
	no ident after #
	no nline after file end
	no token definition
	overload resolution
	prototype
	prototype ( weak )
	rvalue token as const
	text after directive
	this lvalue
	unify incompatible string literal
	unknown directive
	unknown escape
	unknown pragma
	unknown struct / union
	unmatched quote
	unreachable code
	variable initialization
	weak macro equality
	writeable string literal

inttype-spec :
	for const / volatile
	for external declaration
	for function return

overload-spec :
	( complete )
	( incomplete )


keyword-directive :
	keyword identifier for keyword-spec
	undef keyword identifier

keyword-spec :
	discard value
	discard variable
	exhaustive
	fall into case
	keyword identifier
	operator operator
	set
	set reachable
	set unreachable
	type representation
	weak


type-directive :
	bottom identifier
	character character-sign
	character character-literal character-mapping
	character string-literal character-mapping
	compute promote identifier
	escape character-literal character-mapping
	integer literal literal-spec
	promoted type-id : type-id
	set character literal : type-id
	set longlong type : longlong-spec
	set ptrdiff_t : type-id
	set size_t : type-id
	set wchar_t : type-id
	set string literal : string-const
	set std namespace : scope-name
	type identifier for type-spec

character-sign :
	signed
	unsigned
	either

character-mapping :
	as character-literal allow
	disallow

literal-spec :
	literal-base literal-suffix? literal-type-list

literal-base :
	decimal
	octal
	hexadecimal

literal-suffix :
	unsigned
	long
	unsigned long
	long long
	unsigned long long

literal-type-list :
	* literal-type-spec
	integer-literal literal-type-spec | literal-type-list
	? literal-type-spec | literal-type-list

literal-type-spec :
	: type-id
	* allow? : identifier
	* * allow? :

longlong-spec :
	long
	long long

string-const :
	const
	no const

scope-name :
	identifier
	::

type-spec :
	bottom
	ptrdiff_t
	size_t
	wchar_t
	... printf
	... scanf


linkage-directive :
	const linkage linkage
	external linkage string-literal
	external volatile_t
	inline linkage linkage
	linkage resolution : linkage-spec

linkage :
	external
	internal

linkage-spec :
	( linkage ) on
	( linkage ) warning
	off


misc-directive :
	argument type-id as ...
	argument type-id as type-id
	compatible type : type-id == type-id : allow
	conversion identifier-list allow
	declaration block identifier begin
	declaration block end
	directive directive-spec directive-state
	discard expression
	exhaustive
	explicit cast cast-spec? allow
	includes depth integer-literal
	preserve preserve-list
	set expression
	set error limit integer-literal
	set name limit integer-literal warning?
	suspend static identifier-list

directive-spec :
	assert
	file
	ident
	import
	include_next
	unassert
	warning
	weak

directive-state :
	allow
	warning
	disallow
	( ignore ) allow
	( ignore ) warning

cast-operator :
	static_cast
	const_cast
	reinterpret_cast

cast-spec :
	as cast-operator
	cast-spec | cast-operator

preserve-list :
	identifier-list
	*

identifier-list :
	identifier identifier-list?


token-directive :
	token token-spec
	no_def token-list
	define token-list
	ignore token-list
	interface token-list
	undef token token-list
	extend interface header-name
	implement interface header-name

tendra-token-directive :
	token token-spec
	no_def token-list
	define token-list
	reject token-list
	interface token-list
	undef token token-list
	extend header-name
	implement header-name
	member definition type-id : identifier member-offset

member-offset :
	::? id-expression
	member-offset . ::? id-expression
	member-offset [ constant-expression ]

token-list :
	token-id token-list?
	# preproc-token-list

token-id :
	token-namespace? identifier
	type-id . identifier


token-spec :
	token-introduction token-identification

token-introduction :
	exp-token
	statement-token
	type-token
	member-token
	procedure-token

token-identification :
	token-namespace? identifier # external-identifier?

token-namespace :
	TAG

external-identifier :
	-
	preproc-token-list

exp-token :
	EXP exp-storage? : type-id :
	NAT
	INTEGER

exp-storage :
	lvalue
	rvalue
	const

statement-token :
	STATEMENT

type-token :
	TYPE
	VARIETY
	VARIETY signed
	VARIETY unsigned
	FLOAT
	ARITHMETIC
	SCALAR
	CLASS
	STRUCT
	UNION

member-token :
	MEMBER access-specifier? member-type-id : type-id :

member-type-id :
	type-id
	type-id % constant-expression

access-specifier :
	public
	protected
	private

procedure-token :
	general-procedure
	simple-procedure
	function-procedure

general-procedure :
	PROC { bound-toks? | prog-pars? } token-introduction

bound-toks :
	bound-token
	bound-token , bound-toks

bound-token :
	token-introduction token-namespace? identifier

prog-pars :
	program-parameter
	program-parameter , prog-pars

program-parameter :
	EXP identifier
	STATEMENT identifier
	TYPE type-id
	MEMBER type-id : identifier
	PROC identifier

simple-procedure :
	PROC ( simple-toks? ) token-introduction

simple-toks :
	simple-token
	simple-token , simple-toks

simple-token :
	token-introduction token-namespace? identifier?

function-procedure :
	FUNC type-id :

C Pragma syntax

pragma_syntax:
	#pragma TenDRA tendra_pragma
	#pragma token token_pragma
	#pragma token_operation
	#pragma integer_pragma

tendra_pragma:
	begin 
	begin name environment identifier 
	declaration block identifier begin 
	declaration block end 
	directory name use environment identifier
	use environment identifier
	end analysis_specfunction_pars 
	keyword identifier for keyword_spec
	type identifier for type_speccheck_pragmavariable_pragmadialect_pragma

analysis_spec:
	complete struct/union analysis state 
	conversion conv_list allow 
	conversion analysis conversion_spec 
	discard analysis discard_spec 
	enum switch analysis state 
	fall into case permit 
	function pointer as pointer permit 
	integer operator analysis state 
	integer overflow analysis state 
	nested comment analysis state 
	operator precedence analysis state 
	unreachable code permit 
	variable analysis state 
	variable hiding analysis state 
	weak prototype analysis state 

conversion_spec:
	empty
	( int-int ) 
	( int-int explicit ) 
	( int-int implicit ) 
	( int-enum implicit) 
	(enum-int implicit) 
	( int-pointer ) 
	( int-pointer explicit ) 
	(int-pointer implicit ) 
	( pointer-int ) 
	( pointer-int explicit ) 
	( pointer-int implicit ) 
	( pointer-pointer ) 
	( pointer-pointer explicit ) 
	( pointer-pointer implicit ) 

discard_spec:
	empty
	( function return ) 
	( static ) 
	( value ) 

function_pars:
	argument type_name as
	type_name 
	argument type_name as ... 
	extra ... permit 

keyword_spec:
	discard value 
	discard variable 
	exhaustive 
	fall into case 
	set 
	set reachable 
	set unreachable 
	type representation 
	weak 

type_spec:
	bottom 
	... printf 
	... scanf 

check_pragma:
	implicit function declaration state 
	incompatible interface declaration permit 
	incompatible void return permit 

variable_pragma:
	discard identifierseparator 
	preserve identifier_list 
	set identifier separator 
	suspend static identifier_list 
	exhaustive 

separator:
	;
	,

identifier_list:
	identifier
	identifieridentifier_list

dialect_pragma:
	++ 
	assignment as bool permit 
	bitfield overflow permit 
	block function static permit 
	character set_sign 
	character escape overflow permit 
	compatible type : char * == void * : permit 
	conditional lvalue dallow 
	const conditional permit 
	dollar as ident dallow 
	directive pp_directive pp_spec 
	directive as macro argument permit 
	external volatile_t 
	extra ; permit 
	extra ; after conditional permit 
	extra , permit 
	extra bitfield int type permit 
	extra macro definition dallow 
	extra type definition permit 
	forward enum declaration dallow 
	floating point equality permit 
	ident ... permit 
	ignore struct/union/enum tag status 
	implicit int type for external declaration permit 
	implicit int type for function return permit 
	includes depth integral_constant 
	incompatible linkage permit 
	incompatible promoted function argument dallow 
	incompatible type qualifier dallow 
	incomplete type as object type permit 
	indented # directive permit 
	initialization of struct/union (auto) permit 
	linkage resolution : linkage_spec 
	longlong type permit 
	no directive/nline after ident permit 
	no external declaration permit 
	no ident after # permit 
	no nline after file end permit 
	prototype permit 
	prototype (weak) permit 
	set longlong type : type_name 
	set name limit integer_constant 
	set size_t : type_name  
	text after directive permit 
	unify external linkage status 
	unify incompatible string literal permit 
	unknown escape permit 
	unknown pragma permit 
	unknown struct/union dallow 
	unknown directive permit 
	unmatched quote permit 
	variable initialization dallow 
	weak macro equality permit 
	writeable string literal permit 

set_sign:
	signed
	unsign
	either

pp_directive:
	file
	ident
	assert
	unassert
	weak

pp_spec:
	allow
	warning
	(ignore) allow
	(ignore) warning

linkage_spec:
	(internal) on
	(internal) warning
	(external) on
	(external) warning
	off

state:
	on
	warning
	off

permit:
	allow
	warning
	disallow

dallow:
	allow
	disallow

token_pragma:
	ARITHMETIC 
	DEFINE MEMBER
	EXP 
	FUNC 
	MEMBER 
	NAT 
	PROC 
	STATEMENT 
	STRUCT 
	TYPE 
	UNION 
	VARIETY 

token_operation:
	define
	no_def
	extend
	ignore
	implement
	interface
	promote 

integer_pragma:
	integer literal lit_class_type_list 

lit_class_type_list:
	*int_type_spec
	integer_constant int_type_spec | lit_class_type_list

int_type_spec:
	type_name
	*warning? : identifier
	** :