Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arithmetic expansion semantics (POSIX portability) #169

Closed
11 tasks done
Tracked by #51
magicant opened this issue Jul 10, 2022 · 1 comment
Closed
11 tasks done
Tracked by #51

Arithmetic expansion semantics (POSIX portability) #169

magicant opened this issue Jul 10, 2022 · 1 comment
Labels
tracker List of subtasks
Projects

Comments

@magicant
Copy link
Owner

magicant commented Jul 10, 2022

For non-portable extensions to the arithmetic expansion semantics, see #261.

@magicant magicant added this to To do in Main via automation Jul 10, 2022
@magicant magicant moved this from To do to In progress in Main Jul 10, 2022
@magicant
Copy link
Owner Author

magicant commented Jul 12, 2022

Syntax of arithmetic expansion:

AssignmentExp := ConditionalExp
               | ConditionalExp AssignmentOperator AssignmentExp;
ConditionalExp := LogicalOrExp
                | LogicalOrExp "?" AssignmentExp ":" ConditionalExp;
LogicalOrExp := LogicalAndExp | LogicalOrExp "||" LogicalAndExp;
LogicalAndExp := InclusiveOrExp | LogicalAndExp "&&" InclusiveOrExp;
InclusiveOrExp := ExclusiveOrExp | InclusiveOrExp "|" ExclusiveOrExp;
ExclusiveOrExp := AndExp | ExclusiveOrExp "^" AndExp;
AndExp := EqualityExp | AndExp "&" EqualityExp;
EqualityExp := RelationalExp
             | EqualityExp "==" RelationalExp
             | EqualityExp "!=" RelationalExp;
RelationalExp := ShiftExp
               | RelationalExp "<" ShiftExp
               | RelationalExp ">" ShiftExp
               | RelationalExp "<=" ShiftExp
               | RelationalExp ">=" ShiftExp;
ShiftExp := AdditiveExp
          | ShiftExp "<<" AdditiveExp | ShiftExp ">>" AdditiveExp;
AdditiveExp := MultiplicativeExp
             | AdditiveExp "+" MultiplicativeExp
             | AdditiveExp "-" MultiplicativeExp;
MultiplicativeExp := PrefixExp
                   | MultiplicativeExp "*" PrefixExp
                   | MultiplicativeExp "/" PrefixExp
                   | MultiplicativeExp "%" PrefixExp;
PrefixExp := PostfixExp
           | "++" PrefixExp | "--" PrefixExp
           | "+" PrefixExp | "-" PrefixExp
           | "~" PrefixExp | "!" PrefixExp;
PostfixExp := PrimaryExp
            | PostfixExp "++" | PostfixExp "--";
PrimaryExp := "(" AssignmentExp ")" | Number | Identifier;

Operators:

Precedence Associativity Operators
0 Enclosing ) :
1 Right =, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=
2 Right ?
3 Left ||
4 Left &&
5 Left |
6 Left ^
7 Left &
8 Left ==, !=
9 Left <, >, <=, >=
10 Left <<, >>
11 Left +, -
12 Left *, /, %
13 Prefix ++, --, +, -, ~, !
14 Postfix ++, --
15 Enclosing (

@magicant magicant moved this from In progress to To do in Main Aug 23, 2022
@magicant magicant added the tracker List of subtasks label Sep 4, 2022
@magicant magicant changed the title Arithmetic expansion Arithmetic expansion semantics (POSIX portability) May 14, 2023
@magicant magicant mentioned this issue May 14, 2023
26 tasks
@magicant magicant added this to the POSIX 2018 w/o interaction milestone Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracker List of subtasks
Projects
Status: Done
Main
  
To do
Development

No branches or pull requests

1 participant