mirror of
https://github.com/boostorg/phoenix.git
synced 2026-02-13 12:42:11 +00:00
268 lines
10 KiB
Plaintext
268 lines
10 KiB
Plaintext
[/==============================================================================
|
|
Copyright (C) 2001-2010 Joel de Guzman
|
|
Copyright (C) 2001-2005 Dan Marsden
|
|
Copyright (C) 2001-2010 Thomas Heller
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
===============================================================================/]
|
|
|
|
[section Reference]
|
|
|
|
[section Phoenix Expressions]
|
|
|
|
[section:phoenix_ast Language Definition - The Pheonix AST]
|
|
|
|
[teletype]
|
|
|
|
[def __phoenix_peg__ [link phoenix.reference.phoenix_expressions.phoenix_ast phoenix]]
|
|
[def __phoenix_peg_terminals__ [link phoenix.reference.phoenix_expressions.phoenix_ast.terminals terminals]]
|
|
[def __phoenix_peg_operator__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator operator]]
|
|
[def __phoenix_peg_operator_arithmetic__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator.arithmetic arithmetic]]
|
|
[def __phoenix_peg_operator_bitwise__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator bitwise]]
|
|
[def __phoenix_peg_operator_comparision__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator comparision]]
|
|
[def __phoenix_peg_operator_if_else__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator if_else]]
|
|
[def __phoenix_peg_operator_io__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator io]]
|
|
[def __phoenix_peg_operator_logical__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator logical]]
|
|
[def __phoenix_peg_operator_member__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator member]]
|
|
[def __phoenix_peg_operator_self__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator self]]
|
|
[def __phoenix_peg_statement__ [link phoenix.reference.phoenix_expressions.phoenix_ast.operator statement]]
|
|
[def __phoenix_peg_object__ [link phoenix.reference.phoenix_expressions.phoenix_ast.object object]]
|
|
[def __phoenix_peg_function__ [link phoenix.reference.phoenix_expressions.phoenix_ast.function function]]
|
|
[def __phoenix_peg_bind__ [link phoenix.reference.phoenix_expressions.phoenix_ast.bind bind]]
|
|
[def __phoenix_peg_scope__ [link phoenix.reference.phoenix_expressions.phoenix_ast.scope scope]]
|
|
[def __phoenix_peg_fusion__ [link phoenix.reference.phoenix_expressions.phoenix_ast.fusion fusion]]
|
|
|
|
phoenix := statement ( "," statement )*
|
|
|
|
statement := expression | loops | if_statement | exception | switch
|
|
|
|
expression := operator
|
|
|
|
primary_expr := terminal
|
|
| "if_else(" expression "," expression "," expression ")"
|
|
| cast
|
|
| construction
|
|
| bind
|
|
| scope
|
|
| ( "(" expression ")" )
|
|
|
|
terminal := value | reference | placeholder
|
|
|
|
cast := static_cast | dynamic_cast | reinterpret_cast | const_caste
|
|
|
|
static_cast := "static_cast_<" T ">(" expression ")"
|
|
dynamic_cast := "static_cast_<" T ">(" expression ")"
|
|
reinterpret_cast := "static_cast_<" T ">(" expression ")"
|
|
const_cast := "static_cast_<" T ">(" expression ")"
|
|
|
|
construction := ( ( "construct" | "new" ) "<" T ">(" [ expression ( "," expression )* ] ")" ) |
|
|
( "delete_(" expression ")" )
|
|
|
|
bind := "bind(" ( expression | function_pointer ) ( "," expression )* ")"
|
|
|
|
scope := let | lambda
|
|
|
|
local_var_def := local_var_name "=" expression
|
|
|
|
let := "let(" [ local_var_def ( "," local_var_def )* ] ")[" phoenix "]"
|
|
|
|
lambda := "lambda" [ "(" [ local_var_def ( "," local_var_def )* ] ")" ] "[" phoenix "]"
|
|
|
|
loops := for_loop | while_loop | do_while_loop
|
|
|
|
for_loop := "for_(" expression "," expression "," expression ")[" phoenix "]"
|
|
|
|
while_loop := "while_(" expression ")[" phoenix "]"
|
|
|
|
do_while_loop := "do_[" phoenix "].while_(" expression ")"
|
|
|
|
if_statement := "if_(" expression ")[" statement "]" [ ".else_[" phoenix "]" ]
|
|
|
|
exception := throw | try_catch
|
|
|
|
throw := "throw_(" [ expression ] ")"
|
|
|
|
try_catch := "try_[" phoenix "]"
|
|
( ".catch_<" exception ">()[" phoenix "]" )*
|
|
[ ".catch_all[" phoenix "]" ]
|
|
|
|
switch := "switch_(" expression ")[" (
|
|
( case_statement ( "," case_statement )* [ "," default_statement ] |
|
|
default_statement
|
|
)
|
|
|
|
case_statement := "case_<" N ">(" phoenix ")"
|
|
default_statement := "default_(" phoenix ")"
|
|
|
|
operator := logical_or_op (
|
|
( "=" logical_or_op )* |
|
|
( "+=" logical_or_op )* |
|
|
( "-=" logical_or_op )* |
|
|
( "*=" logical_or_op )* |
|
|
( "/=" logical_or_op )* |
|
|
( "%=" logical_or_op )* |
|
|
( "&=" logical_or_op )* |
|
|
( "^=" logical_or_op )* |
|
|
( "|=" logical_or_op )* |
|
|
( "<<=" logical_or_op )* |
|
|
( ">>=" logical_or_op )*
|
|
)
|
|
|
|
logical_or_op := logical_and_op ( "||" logical_and_op )*
|
|
|
|
logical_and_op := bitwise_or_op ( "&&" bitwise_or_op )*
|
|
|
|
bitwise_or_op := bitwise_xor_op ( "|" bitwise_xor_op )*
|
|
|
|
bitwise_xor_op := bitwise_and_op ( "^" bitwise_and_op )*
|
|
|
|
bitwise_and_op := equality_op ( "&" equality_op )*
|
|
|
|
equality_op := relational_op (
|
|
( "==" relational_op )* |
|
|
( "!=" relational_op )*
|
|
)
|
|
|
|
relational_op := shift_op (
|
|
( "<" shift_op )* |
|
|
( ">" shift_op )* |
|
|
( "<=" shift_op )* |
|
|
( ">=" shift_op )*
|
|
)
|
|
|
|
shift_op := additive_op (
|
|
( "<<" additive_op )* |
|
|
( ">>" additive_op )*
|
|
)
|
|
|
|
additive_op := multiplicative_op (
|
|
( "+" multiplicative_op )* |
|
|
( "-" multiplicative_op )*
|
|
)
|
|
|
|
multiplicative_op := member_pointer_op (
|
|
( "*" member_pointer_op )* |
|
|
( "/" member_pointer_op )* |
|
|
)
|
|
|
|
member_pointer_op := unary_op ( "->*" unary_op )*
|
|
|
|
unary_op := unary_postfix_op
|
|
| ( "*" unary_postfix_op )
|
|
| ( "&" unary_postfix_op )
|
|
| ( "+" unary_postfix_op )
|
|
| ( "-" unary_postfix_op )
|
|
| ( "~" unary_postfix_op )
|
|
| ( "!" unary_postfix_op )
|
|
| ( "++" unary_postfix_op )
|
|
| ( "--" unary_postfix_op )
|
|
|
|
unary_postfix_op := primary_expr
|
|
| ( primary_expr "[" expression "]" )
|
|
| ( primary_expr "(" expression ( "," expression )* ")" )
|
|
| ( primary_expr "++" )
|
|
| ( primary_expr "--" )
|
|
|
|
|
|
|
|
|
|
[/
|
|
phoenix := __phoenix_peg_terminals__ |
|
|
__phoenix_peg_operator__ |
|
|
__phoenix_peg_statement__ |
|
|
__phoenix_peg_object__ |
|
|
__phoenix_peg_function__ |
|
|
__phoenix_peg_bind__ |
|
|
__phoenix_peg_scope__ |
|
|
__phoenix_peg_fusion__
|
|
|
|
|
|
|
|
[heading Terminals]
|
|
|
|
terminal := placeholder |
|
|
custom_terminal |
|
|
terminal
|
|
|
|
[heading Operator]
|
|
|
|
operator := __phoenix_peg_operator_arithmetic__ |
|
|
__phoenix_peg_operator_bitwise__ |
|
|
__phoenix_peg_operator_comparision__ |
|
|
__phoenix_peg_operator_if_else__ |
|
|
__phoenix_peg_operator_io__ |
|
|
__phoenix_peg_operator_logical__ |
|
|
__phoenix_peg_operator_member__ |
|
|
__phoenix_peg_operator_self__
|
|
|
|
|
|
[#phoenix.reference.phoenix_expressions.phoenix_ast.operator.arithmetic]
|
|
|
|
arithmetic := ( '-' __phoenix_peg__ ) |
|
|
( '+' __phoenix_peg__ ) |
|
|
( '++' __phoenix_peg__ ) |
|
|
( '--' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '++' ) |
|
|
( __phoenix_peg__ '--' ) |
|
|
( __phoenix_peg__ '+' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '-' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '*' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '/' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '%' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '+=' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '-=' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '*=' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '/=' __phoenix_peg__ ) |
|
|
( __phoenix_peg__ '%=' __phoenix_peg__ )
|
|
|
|
[#phoenix.reference.phoenix_expressions.phoenix_ast.operator.bitwise]
|
|
|
|
bitwise := '~' __phoenix_peg__ |
|
|
( __phoenix_peg__ & __phoenix_peg__ ) |
|
|
( __phoenix_peg__ | __phoenix_peg__ ) |
|
|
( __phoenix_peg__ ^ __phoenix_peg__ ) |
|
|
( __phoenix_peg__ << __phoenix_peg__ ) |
|
|
( __phoenix_peg__ >> __phoenix_peg__ ) |
|
|
( __phoenix_peg__ &= __phoenix_peg__ ) |
|
|
( __phoenix_peg__ |= __phoenix_peg__ ) |
|
|
( __phoenix_peg__ ^= __phoenix_peg__ ) |
|
|
( __phoenix_peg__ <<= __phoenix_peg__ ) |
|
|
( __phoenix_peg__ >>= __phoenix_peg__ ) |
|
|
|
|
|
|
[heading Statement]
|
|
[heading Object]
|
|
[heading Function]
|
|
[heading Bind]
|
|
[heading Scope]
|
|
[heading Stl]
|
|
[heading Fusion]
|
|
]
|
|
|
|
[endsect]
|
|
|
|
[endsect]
|
|
|
|
[/include reference/basics.qbk]
|
|
[/include reference/organisation.qbk]
|
|
[/include reference/concepts.qbk]
|
|
[/include reference/actor.qbk]
|
|
[/include reference/composite.qbk]
|
|
|
|
[/section Modules]
|
|
|
|
[/include reference/core.qbk]
|
|
[/include reference/function.qbk]
|
|
[/include reference/operator.qbk]
|
|
[/include reference/statement.qbk]
|
|
[/include reference/object.qbk]
|
|
[/include reference/scope.qbk]
|
|
[/include reference/bind.qbk]
|
|
[/include reference/stl.qbk]
|
|
|
|
[/endsect]
|
|
|
|
[endsect]
|
|
|