man flx_grammar (Commandes) - Felix grammar summary.
NAME
Felix grammar summary.
Grammar
compilation_unit:
| statement_aster ENDMARKER
expression:
| expr ENDMARKER
statement_aster:
| statement statement_aster
| /* empty */
statement:
| binding_definition
| declarative
| executable
| inclusion
| directive
| publish
| comment
| null_statement
comment:
| COMMENT_KEYWORD STRING SEMI
binding_definition:
| abstract_type
| const_def
| binding_header
| export_statement
publish:
| PUBLISH STRING binding_definition
| PUBLISH STRING declarative
| PRIVATE declarative
| PRIVATE binding_definition
declarative:
| function_definition
| object_definition
| procedure_definition
| module_definition
| union_decl
| struct_decl
| type_alias
directive:
| open_decl
| use_decl
| regdef
| glr_production
| macro_definition
executable:
| var_def
| val_def
| call
| svc
| return
| ifgoto_stmt
| whilst_stmt
| todo
| assignment
| inline_cpp
| goto_statement
| label_statement
| assert_statement
null_statement:
| SEMI
inclusion:
| INCLUDE STRING SEMI
regdef:
| REGEXP NAME EQUAL re1 SEMI
re0:
| re1 AS NAME
| re1
re1:
| re1 VBAR re2
| re2
re2:
| re2 re3
| re3
re3:
| re4 STAR
| re4 PLUS
| re4 QUEST
| re4
re4:
| STRING
| UNDERSCORE
| DOT
| LPAR re0 RPAR
| LSQB charset RSQB
| LSQB CIRCUMFLEX charset RSQB
| re_name
re_name:
| re_name COLONCOLON NAME
| NAME
charset0:
| INTEGER MINUS INTEGER
| STRING MINUS STRING
| STRING
| INTEGER
charset:
| charset charset0
| charset0
tvar:
| NAME
| NAME COLON tpattern
tvar_comma_list:
| tvar COMMA tvar_comma_list
| tvar
| /* empty */
tvarlist:
| LSQB tvar_comma_list RSQB
| /* empty */
type_qual:
| INCOMPLETE
| POD
| GC_POINTER
type_quals:
| type_qual type_quals
| /* empty */
abstract_type:
| type_quals CTYPES basic_name_comma_list requires_clause SEMI
| type_quals TYPE NAME tvarlist EQUAL code_spec requires_clause SEMI
union_decl:
| ENUM NAME LBRACE enum_items RBRACE SEMI
| UNION NAME tvarlist EQUAL type_sum_items SEMI
| UNION NAME tvarlist EQUAL VBAR type_sum_items SEMI
enum_items:
| enum_items COMMA enum_item
| enum_item
enum_item:
| NAME
type_sum_items:
| type_sum_items VBAR type_sum_item
| type_sum_item
type_sum_item:
| NAME OF expr
| NAME
opt_equal:
| EQUAL
| /* empty */
struct_decl:
| STRUCT NAME tvarlist opt_equal LBRACE struct_component_aster RBRACE
| CSTRUCT NAME tvarlist opt_equal LBRACE struct_component_aster RBRACE
| CCLASS NAME tvarlist opt_equal LBRACE class_component_aster RBRACE
struct_component_aster:
| struct_component struct_component_aster
| /* empty */
struct_component:
| NAME COLON expr SEMI
opt_name:
| NAME
| /* empty */
class_component_aster:
| class_component class_component_aster
| /* empty */
class_component:
| VAR NAME COLON expr SEMI
| VAL NAME COLON expr SEMI
| FUNCTION NAME COLON expr opt_cstring SEMI
| PROCEDURE NAME COLON expr opt_cstring SEMI
| CTOR opt_name COLON expr opt_cstring SEMI
const_def:
| CONST NAME tvarlist COLON expr EQUAL code_spec requires_clause SEMI
| CONST NAME tvarlist COLON expr requires_clause SEMI
code_spec:
| STRING
| CSTRING
requirement:
| qualified_name
| BODY code_spec
| HEADER code_spec
| PROPERTY STRING
requirements:
| requirement COMMA requirements
| requirement
requires_clause:
| REQUIRES requirements
| /* empty */
binding_header:
| HEADER code_spec requires_clause SEMI
| BODY code_spec requires_clause SEMI
| HEADER EQUAL code_spec requires_clause SEMI
| BODY EQUAL code_spec requires_clause SEMI
| HEADER NAME tvarlist EQUAL code_spec requires_clause SEMI
| BODY NAME tvarlist EQUAL code_spec requires_clause SEMI
| REQUIRES requirements SEMI
| NAME REQUIRES requirements SEMI
inline_cpp:
| CODE code_spec SEMI
| NORETURN CODE code_spec SEMI
type_alias:
| TYPEDEF NAME tvarlist EQUAL expr SEMI
| TYPEDEF FUNCTION NAME tvarlist fun_args COLON expr EQRIGHTARROW expr SEMI
| TYPEDEF FUNCTION NAME tvarlist COLON expr EQUAL type_matchings SEMI
| RENAME NAME tvarlist EQUAL qualified_name SEMI
| RENAME FUNCTION NAME tvarlist EQUAL qualified_name SEMI
| INHERIT qualified_name SEMI
export_statement:
| EXPORT FUNCTION suffixed_name AS STRING SEMI
| EXPORT PROCEDURE suffixed_name AS STRING SEMI
| EXPORT TYPE LPAR expr RPAR AS STRING SEMI
open_decl:
| OPEN qualified_name SEMI
use_decl:
| USE qualified_name SEMI
| USE NAME EQUAL qualified_name SEMI
mac_arg:
| NAME COLON FUNCTION
| NAME COLON PROCEDURE
| NAME COLON NAME
| NAME
mac_args:
| mac_arg COMMA mac_args
| mac_arg
mac_arg_list:
| LPAR mac_args RPAR
| LPAR RPAR
macro_definition:
| MACRO NAME IS expr SEMI
| MACRO FOR NAME IN expr DO statement_aster DONE SEMI
/*
| MACRO NAME COLON LIST IDENT EQUAL rev_name_list SEMI
*/
| MACRO NAME IS NEW SEMI
| MACRO VAR NAME EQUAL expr SEMI
| MACRO NAME EQUAL expr SEMI
| MACRO VAL NAME EQUAL expr SEMI
| MACRO VAL NAME IS tuple SEMI
| MACRO FUNCTION NAME mac_arg_list EQUAL expr SEMI
| MACRO PROCEDURE NAME mac_arg_list compound
| MACRO FORGET macro_names SEMI
| MACRO GOTO NAME SEMI
| MACRO NAME COLONGREATER
| MACRO IF expr GOTO NAME SEMI
| MACRO FOR VAL NAME IN tuple DO statement_aster DONE SEMI
macro_name_list:
| macro_name_list NAME
| NAME
macro_names:
| macro_name_list
| /* empty */
/*
rev_name_list:
| NAME COMMA rev_name_list
| NAME
*/
fun_arg:
| LPAR parameter_comma_list WHEN expr RPAR
| LPAR parameter_comma_list RPAR
| NAME
fun_args:
| fun_arg fun_args
| fun_arg
opt_fun_args:
| fun_args
| /* empty */
opt_type_expr:
| COLON expr EXPECT expr
| COLON expr
| EXPECT expr
| /* empty */
opt_cstring:
| EQUAL code_spec
| /* empty */
adjective:
| INLINE
| NOINLINE
adjectives:
| adjective adjectives
| /* empty */
opt_prec:
| IS NAME
| /* empty */
opt_traint_eq:
| EXPECT expr EQUAL
| /* empty */
function_definition:
| adjectives FUNCTION NAME tvarlist fun_args opt_type_expr EQRIGHTARROW expr SEMI
| adjectives FUNCTION NAME tvarlist fun_args opt_type_expr EQUAL compound
| adjectives FUNCTION NAME tvarlist COLON expr opt_cstring opt_prec requires_clause SEMI
| adjectives FUNCTION NAME tvarlist COLON expr EQUAL matchings SEMI
procedure_definition:
| PROCEDURE NAME tvarlist opt_fun_args opt_traint_eq compound
| adjective PROCEDURE NAME tvarlist fun_args opt_traint_eq compound
| PROCEDURE NAME tvarlist COLON expr opt_cstring requires_clause SEMI
object_definition:
| OBJECT NAME tvarlist fun_args compound
parameter_comma_list:
| parameter COMMA parameter_comma_list
| parameter
| /* empty */
parameter:
| NAME COLON arrow
| NAME
| VAR NAME COLON arrow
| VAR NAME
assert_statement:
| ASSERT expr SEMI
goto_statement:
| GOTO NAME SEMI
label_statement:
| NAME COLONGREATER
svc:
| SVC NAME SEMI
module_definition:
| MODULE NAME tvarlist compound
var_def:
| VAR NAME tvarlist EQUAL expr SEMI
| VAR NAME tvarlist COLON expr LEFTARROW expr SEMI
| VAR AMPER NAME tvarlist COLON expr LEFTARROW expr SEMI
| VAR NAME tvarlist COLON expr EQUAL expr SEMI
| VAR NAME tvarlist COLON expr SEMI
val_def:
| VAL NAME tvarlist EQUAL expr SEMI
| VAL NAME tvarlist COLON expr EQUAL expr SEMI
| VAL NAME tvarlist COLON expr SEMI
return:
| RETURN expr SEMI
| RETURN SEMI
compound:
| LBRACE statement_aster RBRACE
call:
| expr SEMI
| CALL expr SEMI
| JUMP expr SEMI
| LOOP expr SEMI
assignop:
| EQUAL
| COLONEQUAL
rmwop:
| PLUSEQUAL
| MINUSEQUAL
| STAREQUAL
| SLASHEQUAL
| PERCENTEQUAL
| LEFTSHIFTEQUAL
| RIGHTSHIFTEQUAL
| CARETEQUAL
| VBAREQUAL
| AMPEREQUAL
| TILDEEQUAL
swapop:
| LEFTRIGHTARROW
incrop:
| PLUSPLUS
| MINUSMINUS
lelement:
| VAL NAME
| VAR NAME
| NAME
| UNDERSCORE
| LPAR lexprs RPAR
tlelement:
| lelement COLON factor
| lelement
lexprs:
| tlelement COMMA lexprs
| tlelement
lexpr:
| lexprs
assignment:
| expr LEFTARROW expr SEMI
| expr swapop expr SEMI
| DEF lexpr EQUAL expr SEMI
| expr assignop expr SEMI
| expr rmwop expr SEMI
| expr incrop SEMI
| incrop expr SEMI
todo:
| TODO STRING SEMI
| TODO SEMI
elif_clause:
| ELIF expr DO statement_aster
| ELIF expr RETURN SEMI
| ELIF expr GOTO NAME SEMI
elif_clauses:
| elif_clauses elif_clause
| elif_clause
else_clause:
| elif_clauses ELSE statement_aster
| ELSE statement_aster
ifgoto_stmt:
| IF expr GOTO NAME SEMI
| IF expr RETURN SEMI
| IF expr DO statement_aster else_clause DONE SEMI
| IF expr DO statement_aster DONE SEMI
whilst_stmt:
| WHILST expr DO statement_aster DONE SEMI
| UNTIL expr DO statement_aster DONE SEMI
regmatch_expr:
| REGMATCH expr WITH regmatch_alternatives ENDMATCH
| REGLEX expr TO expr WITH regmatch_alternatives ENDMATCH
regmatch_alternatives:
| regmatch_alternatives regmatch_alternative
| regmatch_alternative
regmatch_alternative:
| VBAR re1 EQRIGHTARROW expr
match_expr:
| MATCH expr WITH matchings ENDMATCH
matchings:
| matching matchings
| matching
matching:
| VBAR pattern EQRIGHTARROW expr
| VBAR EQRIGHTARROW expr
pattern:
| as_pattern WHEN expr
| as_pattern
as_pattern:
| variant_pattern AS NAME
| variant_pattern
variant_pattern:
| tuple_pattern
tuple_pattern:
| coercive_pattern_list
coercive_pattern_list:
| coercive_pattern COMMA coercive_pattern_list
| coercive_pattern
coercive_pattern:
| atomic_pattern COLON arrow
| atomic_pattern
atomic_pattern:
/* constants */
| STRING
| integral
| NAN
/* ranges */
| STRING DOTDOT STRING
| integral DOTDOT integral
| floating DOTDOT floating
/* other */
| ctor_pattern
/*
| QUEST NAME
*/
| QUEST NAME
| QUEST
| UNDERSCORE
| LPAR pattern RPAR
| REGEXP STRING LPAR basic_name_comma_list RPAR
ctor_pattern:
| ctor_name atomic_pattern
| ctor_name
ctor_name:
| simple_name_parts
| CASE INTEGER
integral:
| INTEGER
| MINUS INTEGER
floating:
| FLOAT
| MINUS FLOAT
| INF
| MINUS INF
basic_name:
| NAME
basic_name_comma_list:
| basic_name COMMA basic_name_comma_list
| basic_name
| /* empty */
tpattern_comma_list:
| tpattern COMMA tpattern_comma_list
| tpattern
| /* empty */
tuple_tpattern:
| tpattern_comma_list
tpattern:
| tpattern AS NAME
| tpat0
tpat0:
| tpat1 RIGHTARROW tpat0
| tpat1
tpat1:
| sumpat
sumpat:
| tpat2 PLUS sumpat
| tpat2
tpat2:
| mulpat
mulpat:
| tpat3 STAR mulpat
| tpat3
tpat3:
| NAME tpatlist
| LPAR tuple_tpattern RPAR
| QUEST NAME
| QUEST
| UNDERSCORE
| INTEGER
tpatlist:
| LSQB tpattern_comma_list RSQB
| /* empty */
type_match_expr:
| TYPEMATCH expr WITH type_matchings ENDMATCH
type_matchings:
| type_matching type_matchings
| type_matching
type_matching:
| VBAR tuple_tpattern EQRIGHTARROW expr
glr_term:
| qualified_name
/* | LSQB glr_alts RSQB */
| LBRACE glr_alternatives RBRACE
| LPAR glr_alternatives RPAR
| glr_term QUEST
| glr_term STAR
| glr_term PLUS
glr_alternatives:
| glr_sequence VBAR glr_alts
| glr_sequence
glr_alts:
| glr_sequence VBAR glr_alts
| glr_sequence
glr_sequence:
| glr_term glr_seqs
| glr_term
glr_seqs:
| glr_term glr_seqs
| glr_term
glr_entry:
| NAME COLON glr_term
| glr_term
glr_entries:
| glr_entry glr_entries
| glr_entry
glr_matching:
| VBAR glr_entries EQRIGHTARROW expr
| VBAR EQRIGHTARROW expr
glr_matchings:
| glr_matching glr_matchings
| glr_matching
glr_production:
| NONTERM NAME COLON expr EQUAL glr_matchings SEMI
glr_parse:
| PARSE expr WITH glr_matchings ENDMATCH
expr:
| LET pattern EQUAL expr IN expr
| rvalue
rvalue:
| lambda
/* cannot use fun_args, since ambiguity on the third case (NAME) */
lambda_fun_arg:
| LPAR parameter_comma_list WHEN expr RPAR
| LPAR parameter_comma_list RPAR
lambda_fun_args:
| lambda_fun_arg lambda_fun_args
| lambda_fun_arg
lambda:
| dollar_apply
| adjectives FUNCTION lambda_fun_args opt_type_expr EQUAL compound
| adjectives FUNCTION lambda_fun_args opt_type_expr EQRIGHTARROW expr
| PROCEDURE lambda_fun_args compound
| PROCEDURE compound
dollar_apply:
| tuple DOLLAR dollar_apply
| tuple
tuple:
| or_condition tuple_suffix
| or_condition
tuple_suffix:
| COMMA or_condition tuple_suffix
| COMMA or_condition
/*orop:
| OR
or_condition:
| or_condition orop and_condition
| and_condition
*/
/* oring formation is 'psuedo-associative' */
or_condition:
| and_condition OR or_list
| and_condition
or_list:
| and_condition OR or_list
| and_condition
/* oring formation is 'psuedo-associative' */
and_condition:
| not_condition AND and_list
| not_condition
and_list:
| not_condition AND and_list
| not_condition
/*
andop:
| AND
and_condition:
| and_condition andop not_condition
| not_condition
*/
notop:
| NOT
not_condition:
| notop not_condition
| comparison
chain_cmp_op:
| ANDEQEQUAL
| ANDNOTEQUAL
| ANDLESS
| ANDGREATER
| ANDLESSEQUAL
| ANDGREATEREQUAL
cmp_item:
| chain_cmp_op sum
cmp_item_list:
| cmp_item cmp_item_list
| cmp_item
cmp_op:
| EQEQUAL
| NOTEQUAL
| LESS
| GREATER
| LESSEQUAL
| GREATEREQUAL
| ISIN
/* hack */
comparison:
| sum cmp_op sum cmp_item_list
| sum cmp_op sum
| as_expr
as_expr:
| as_expr AS NAME
| setunion
setunion:
| user10 VBARVBAR setunion_list
| user10
setunion_list:
| user10 VBARVBAR setunion_list
| user10
user10:
| user10 USER10 setintersection
| setintersection
setintersection:
| arrow AMPERAMPER setintersection_list
| arrow
setintersection_list:
| arrow AMPERAMPER setintersection_list
| arrow
arrow:
| case_literal RIGHTARROW arrow
| case_literal
case_literal:
| CASE INTEGER
| CASE INTEGER OF sum
| bor
bor:
| bor SLOSHVBAR bxor
| bxor
bxor:
| bxor SLOSHCIRCUMFLEX band
| band
band:
| band SLOSHAMPER shift
| shift
shift:
| shift LEFTSHIFT sum
| shift RIGHTSHIFT sum
| sum
/* sum formation is 'psuedo-associative' */
sum:
| subtraction PLUS sum_list
| subtraction
sum_list:
| subtraction PLUS sum_list
| subtraction
subtraction:
| subtraction MINUS product
| product
/* product formation is 'psuedo-associative' */
product:
| term STAR product_list
| term
product_list:
| term STAR product_list
| term
/* division is left associative: note higher precedence
the product, so that
a * b/c * d -> a * (b/c) * d
*/
term:
| term SLASH power
| term PERCENT power
| prefixed
/* note weird recursion here: we need to support
-x ** -x = -(x**(-x))
*/
prefixed:
| LVAL power
| PLUS power
| MINUS power
| TILDE power
| power
/* exponentiation is right associative */
power:
| superscript STARSTAR prefixed
| superscript
superscript:
| superscript CIRCUMFLEX refr
| refr
refr:
| AMPER refr
| STAR refr
| application
/* applications is left associative */
application:
| application coercion
/*
| MAP coercion coercion
*/
| CASENO coercion
| coercion
coercion:
| coercion COLON factor
| suffixed_name
| factor
factor:
| dollar_name
| factor DOT LSQB expr RSQB
| factor DOT LSQB expr TO expr RSQB
| factor DOT LSQB expr TO RSQB
| factor DOT LSQB TO expr RSQB
| factor DOT NAME
| factor DOT LPAR INTEGER RPAR
dollar_name:
| NOEXPAND qualified_name
| THE qualified_name
| qualified_name
| atom
qualified_name:
| qualified_name COLONCOLON simple_name_parts
| simple_name_parts
elif:
| ELIF expr THEN expr
elifs:
| elifs elif
| elif
else_part:
| elifs ELSE expr
| ELSE expr
cond:
| IF expr THEN expr else_part ENDIF
expr_code_prefix:
| CODE LSQB expr RSQB
atom:
| DOTDOTDOT
| type_match_expr
| expr_code_prefix NAME
| expr_code_prefix STRING
| LSQBAR expr RSQBAR
| LBRACE expr RBRACE
| glr_parse
| match_expr
| regmatch_expr
| compound
| LPAR expr RPAR
| LPAR RPAR
| literal
| cond
| USERLB expr USERRB
literal:
| INTEGER
| FLOAT
| STRING
| CSTRING
simple_name_parts:
| NAME LSQB expr RSQB
| NAME
suffixed_name:
| qualified_name OF LPAR expr RPAR
VERSION
1.1.1_rc1
SEE ALSO
felix(1)
for a language introduction and man page index
flx(1)
for a list of the tools.
flxcc(1)
for a description of the wrapper generator tool.
flx_lit(1)
for a description of literals
flx_op(1)
for a list of operators
flx_cop(1)
for a list of C operator precedence names
flx_key(1)
for a list of keywords
flx_grammar(1)
for a grammar summary
flx_lib_typ(1)
for a list of library types
flx_dir(1)
for a list of directives
flx_exec(1)
for a list of executable statements
flx_decl(1)
for a list of declarative statements
flx_bind(1)
for a list of binding statements
WEB SITE
See
http://felix.sourceforge.net
AUTHOR
John Maxwell Skaller, mailto:skaller@users.sourceforge.net