⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 java.syntax

📁 java 词法分析器,用于一般的C,C++,VB,PS/SQL 语句的翻译
💻 SYNTAX
📖 第 1 页 / 共 2 页
字号:
/////////////////// Java syntax ///////////////////// 19.2) The Syntactic Grammargoal ::=	compilation_unit	;// 19.3) Lexical Structure.literal ::=	INTEGER_LITERAL	|	FLOATING_POINT_LITERAL	|	BOOLEAN_LITERAL	|	CHARACTER_LITERAL	|	STRING_LITERAL	|	NULL_LITERAL	;// 19.4) Types, Values, and Variablestype	::=	primitive_type	|	reference_type	;primitive_type ::=		numeric_type	|	BOOLEAN	;numeric_type ::=	integral_type	|	floating_point_type	;integral_type ::= 		BYTE 	|	SHORT 	|	INT 	|	LONG 	|	CHAR 	;floating_point_type ::= 		FLOAT 	|	DOUBLE	;reference_type ::=		class_or_interface_type	|	array_type	;class_or_interface_type ::= name;class_type ::=	class_or_interface_type;interface_type ::= class_or_interface_type;		array_type ::=	primitive_type dims	|	name dims	;// 19.5) Namesname	::=	simple_name	|	qualified_name	;simple_name ::=	IDENTIFIER	;qualified_name ::=		name DOT IDENTIFIER	;// 19.6) Packagescompilation_unit ::=		package_declaration_opt 		import_declarations_opt		type_declarations_opt		;package_declaration_opt ::= package_declaration | ;import_declarations_opt ::= import_declarations | ;type_declarations_opt   ::= type_declarations   | ;import_declarations ::= 		import_declaration	|	import_declarations import_declaration	;type_declarations ::= 		type_declaration	|	type_declarations type_declaration	;package_declaration ::= 		PACKAGE name SEMICOLON	;import_declaration ::= 		single_type_import_declaration	|	type_import_on_demand_declaration	;single_type_import_declaration ::= 		IMPORT name SEMICOLON	;type_import_on_demand_declaration ::=		IMPORT name DOT MULT SEMICOLON	;type_declaration ::=		class_declaration	|	interface_declaration	|	SEMICOLON	;// 19.7) Productions used only in the LALR(1) grammarmodifiers_opt ::=	|	modifiers	;modifiers ::= 	modifier	|	modifiers modifier	;modifier ::=	PUBLIC | PROTECTED | PRIVATE	|	STATIC	|	ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE	|	STRICTFP // note that semantic analysis must check that the	                 // context of the modifier allows strictfp.	;// 19.8) Classes// 19.8.1) Class Declaration:class_declaration ::= 	modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body	;_super ::=	EXTENDS class_type	;super_opt ::=		|	_super	;interfaces ::=	IMPLEMENTS interface_type_list	;interfaces_opt ::=	|	interfaces 	;interface_type_list ::= 		interface_type	|	interface_type_list COMMA interface_type	;class_body ::=	LBRACE class_body_declarations_opt RBRACE 	;class_body_declarations_opt ::= 	|	class_body_declarations ;class_body_declarations ::= 		class_body_declaration	|	class_body_declarations class_body_declaration	;class_body_declaration ::=		class_member_declaration	|	static_initializer	|	constructor_declaration	|	block	;class_member_declaration ::=		field_declaration	|	method_declaration	/* repeat the prod for 'class_declaration' here: */	|	modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body	|	interface_declaration	;// 19.8.2) Field Declarationsfield_declaration ::= 		modifiers_opt type variable_declarators SEMICOLON	;variable_declarators ::=		variable_declarator	|	variable_declarators COMMA variable_declarator	;variable_declarator ::=		variable_declarator_id	|	variable_declarator_id EQ variable_initializer	;variable_declarator_id ::=		IDENTIFIER	|	variable_declarator_id LBRACK RBRACK	;variable_initializer ::=		expression	|	array_initializer	;// 19.8.3) Method Declarationsmethod_declaration ::=		method_header method_body	;method_header ::=		modifiers_opt type method_declarator throws_opt	|	modifiers_opt VOID method_declarator throws_opt	;method_declarator ::=		IDENTIFIER LPAREN formal_parameter_list_opt RPAREN	|	method_declarator LBRACK RBRACK // deprecated	// be careful; the above production also allows 'void foo() []'	;formal_parameter_list_opt ::=	|	formal_parameter_list	;formal_parameter_list ::=		formal_parameter	|	formal_parameter_list COMMA formal_parameter	;formal_parameter ::=		type variable_declarator_id	|	FINAL type variable_declarator_id	;throws_opt ::=		|	_throws	;_throws ::=	THROWS class_type_list	;class_type_list ::=		class_type	|	class_type_list COMMA class_type	;method_body ::=	block	|	SEMICOLON	;// 19.8.4) Static Initializersstatic_initializer ::=		STATIC block	;// 19.8.5) Constructor Declarationsconstructor_declaration ::=		modifiers_opt constructor_declarator throws_opt 			constructor_body	;constructor_declarator ::=		simple_name LPAREN formal_parameter_list_opt RPAREN	;constructor_body ::=		LBRACE explicit_constructor_invocation			block_statements RBRACE	|	LBRACE explicit_constructor_invocation RBRACE	|	LBRACE block_statements RBRACE	|	LBRACE RBRACE	;explicit_constructor_invocation ::=		THIS LPAREN argument_list_opt RPAREN SEMICOLON	|	SUPER LPAREN argument_list_opt RPAREN SEMICOLON	|	primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON	|	primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON	;// 19.9) Interfaces// 19.9.1) Interface Declarationsinterface_declaration ::=		modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt 			interface_body	;extends_interfaces_opt ::=	|	extends_interfaces	;extends_interfaces ::=		EXTENDS interface_type	|	extends_interfaces COMMA interface_type	;interface_body ::=		LBRACE interface_member_declarations_opt RBRACE	;interface_member_declarations_opt ::=	|	interface_member_declarations	;interface_member_declarations ::=		interface_member_declaration	|	interface_member_declarations interface_member_declaration	;interface_member_declaration ::=		constant_declaration	|	abstract_method_declaration	|	class_declaration	|	interface_declaration	;constant_declaration ::=		field_declaration	// need to semantically check that modifiers of field declaration	// include only PUBIC, STATIC, or FINAL.  Other modifiers are	// disallowed.	;abstract_method_declaration ::=		method_header SEMICOLON	;// 19.10) Arraysarray_initializer ::=		LBRACE variable_initializers COMMA RBRACE	|	LBRACE variable_initializers RBRACE	|	LBRACE COMMA RBRACE	|	LBRACE RBRACE	;variable_initializers ::=		variable_initializer	|	variable_initializers COMMA variable_initializer	;// 19.11) Blocks and Statementsblock ::=	LBRACE block_statements_opt RBRACE	;block_statements_opt ::=	|	block_statements	;block_statements ::=		block_statement	|	block_statements block_statement	;block_statement ::=		local_variable_declaration_statement	|	statement	|	class_declaration	|	interface_declaration	;local_variable_declaration_statement ::=		local_variable_declaration SEMICOLON	;local_variable_declaration ::=		type variable_declarators	|	FINAL type variable_declarators	;statement ::=	statement_without_trailing_substatement	|	labeled_statement	|	if_then_statement	|	if_then_else_statement	|	while_statement	|	for_statement	;statement_no_short_if ::=		statement_without_trailing_substatement	|	labeled_statement_no_short_if	|	if_then_else_statement_no_short_if	|	while_statement_no_short_if	|	for_statement_no_short_if	;statement_without_trailing_substatement ::=		block	|	empty_statement	|	expression_statement	|	switch_statement	|	do_statement	|	break_statement	|	continue_statement	|	return_statement	|	synchronized_statement	|	throw_statement	|	try_statement	;empty_statement ::=		SEMICOLON	;labeled_statement ::=		IDENTIFIER COLON statement	;labeled_statement_no_short_if ::=		IDENTIFIER COLON statement_no_short_if	;expression_statement ::=		statement_expression SEMICOLON	;statement_expression ::=		assignment	|	preincrement_expression	|	predecrement_expression	|	postincrement_expression	|	postdecrement_expression	|	method_invocation	|	class_instance_creation_expression	;if_then_statement ::=		IF LPAREN expression RPAREN statement	;if_then_else_statement ::=		IF LPAREN expression RPAREN statement_no_short_if 			ELSE statement	;if_then_else_statement_no_short_if ::=		IF LPAREN expression RPAREN statement_no_short_if			ELSE statement_no_short_if	;switch_statement ::=		SWITCH LPAREN expression RPAREN switch_block	;switch_block ::=		LBRACE switch_block_statement_groups switch_labels RBRACE	|	LBRACE switch_block_statement_groups RBRACE	|	LBRACE switch_labels RBRACE	|	LBRACE RBRACE	;switch_block_statement_groups ::=

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -