Semantics of identifier line in Python -
what semantics of python 2.7 line containing identifier. i.e. simply
a
or
something
?
if know exact place in reference, i'd pleased. tnx.
an identifier valid expression. expression on line valid statement.
the full semantic chain little more involved. in order have nice operator precedence, classify things "a , b" technically both and_test
, or_test
. result, simple identifier technically qualifies on dozen grammar items
stmt: simple_stmt | compound_stmt simple_stmt: small_stmt (';' small_stmt)* [';'] newline small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt) expr_stmt: testlist_star_expr (augassign (yield_expr|testlist) | ('=' (yield_expr|testlist_star_expr))*) testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [','] test: or_test ['if' or_test 'else' test] | lambdef or_test: and_test ('or' and_test)* and_test: not_test ('and' not_test)* not_test: 'not' not_test | comparison comparison: expr (comp_op expr)* expr: xor_expr ('|' xor_expr)* xor_expr: and_expr ('^' and_expr)* and_expr: shift_expr ('&' shift_expr)* shift_expr: arith_expr (('<<'|'>>') arith_expr)* arith_expr: term (('+'|'-') term)* term: factor (('*'|'/'|'%'|'//') factor)* factor: ('+'|'-'|'~') factor | power power: atom trailer* ['**' factor] atom: ('(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']' | '{' [dictorsetmaker] '}' | name | number | string+ | '...' | 'none' | 'true' | 'false')
a stmt
can composed of single simple_stmt
, can composed of simgle small_stmt
, can composed of single expr_stmt
, , on, down through testlist_star_expr
, test
, or_test
, and_test
, not_test
, comparison
, expr
, xor_expr
, and_expr
, shift_expr
, arith_expr
, term
, factor
, power
, atom
, , name
.
Comments
Post a Comment