TL;DR: AssignExpr doesn’t necessarily mean the expression actaully has any assignment operators, might just be an integer literal or function call.
I’m pretty sure Zig makes the distinction of Expr and AssignExpr because of types in variable declarations. For example, if you have
const i: usize = 0;
Then, the parser would go through functions something like this:
parseContainerMember (the var decl)
...
parseExpr (for the usize)
Because the form a = b is considered an ‘expression’ in Zig, then the parser could consume usize = 0 as the type expression, instead of just usize. The AssignExpr is just there so this sort of ambiguity doesn’t occur.
Function calls are AssignExpr because function calls lie under the PrimaryExpr term. It is confusing, because just because a term is called TypeExpr doesn’t mean it actually is a type, same with AssignExpr. Zig splits it into something like this, with the higher functions calling the lower functions:
parseAssignExpr → assignment operators
parseExpr → infix operators and precedence
parsePrefixExpr → prefix operators
parsePrimaryExpr → blocks, ifs, switches, whiles, control flow
parseTypeExpr → error ! and || operators
parsePrimaryTypeExpr → identifiers, literals
As you can see, the identifiers or variables might not be types, but they are still contained in the parsePrimaryTypeExpr because they might be types, and more general expr parsing functions could call them.
Most of the time, Zig uses parseExpr for general expressions in say functions and stuff, uses parseTypeExpr where a type is expected (like fn ident () T) and parseAssignExpr, the most general expr parsing function, I think only when parsing while continue expressions and expressions blocks.