The LINQ expression rule is:
linqquery : fromClause queryBody
;
fromClause : FROM identifier (AS typeName)? IN expression
;
queryBody : (queryBodyClause)* selectOrGroupclause (queryContinuation)?
;
queryBodyClause : fromClause
| LET identifier ASSIGN_OP expression
| WHERE expression
| JOIN identifier (AS typeName)? IN expression ON expression EQUALS expression joinIntoClause?
| ORDERBY ordering (, ordering)*
;
joinIntoClause : INTO identifier
;
ordering : expression (ASCENDING|DESCENDING)?
;
selectOrGroupclause : SELECT expression
| GROUP expression BY expression
;
queryContinuation : INTO identifier queryBody
An example of a LINQ Query
VAR oAll := FROM D IN oDev ;
JOIN C IN oC ON D:Country EQUALS C:Name ;
ORDERBY D:LastName ;
SELECT CLASS {D:Name, D:Country, C:Region}
In this example you will see
fromclause: FROM D in oDev
querybody 1: JOIN C IN oC ON D:Country EQUALS C:Name
querybody 2: ORDERBY D:LastName
selectOrGroupClause: SELECT CLASS {...}
Other examples can be found in the LINQ Example topic