[Chapel Merge] This is for `compiler/next`.

Branch: refs/heads/main
Revision: 3fd03c2
Author: dlongnecke-cray
Link: Unavailable
Log Message:

Merge pull request #18641 from dlongnecke-cray/next-bunch-of-primers

This is for compiler/next.

Get all but a few primers (chpldoc, FFTWlib, LAPACKlib) to
compile with the new frontend via the --compiler-library-parser
flag.

Add a few new UAST nodes: Scan, TypeQuery, and VarArgFormal.

Adjust the TupleDecl node so that it can also contain Formal.

Adjust the Function::formals() iterator and accessor to yield
Decl instead of Formal.

Adjust the conversion routines in compiler/passes/convert-uast.cpp
as needed to translate new UAST nodes as well as new combinations
of existing nodes (such as edge cases for array types).

Wire up a bunch of productions in the new parser grammar such as
for scans, varargs, loop expressions with filters, and more.

Remove redundant logic for setting config vars in the production
compiler. Reuse this function in the conversion pass for now.

Add a bunch of TODOs for functionality in the conversion pass
powered by the production compiler that should be rewritten
in the new compiler when possible.

Reviewed by @mppf, @arezaii. Thanks!

TESTING:

  • [x] All tests with linux64, COMM=none to verify config change is OK
  • [x] All primers except FFTWlib, LAPACKlib, chpldoc with
    --compiler-library-parser flag

FUTURE WORK:

  • Handle pragmas and conversion of pragmas (ideally using an approach
    like that in #18619)
  • Tackle all remaining TODOEXPR in the the new grammar file
  • Pick another larger group of tests to run next
  • Add verbosity levels to errors (e.g. noteWarning)
  • Begin iterating through all production compiler build routines
    (used by the old parser) and ensuring that their warnings and
    errors also occur in the new parser
  • Consider traversing the tree after parsing (say while assigning
    postorder IDs) and emitting some parse-time errors in order to
    decouple these errors from the parser proper
  • Begin to selectively parse the internal modules with the new parser
  • Add machinery to parse and look up config var values

Signed-off-by: David Longnecker dlongnecke-cray@users.noreply.github.com

Modified Files:
A compiler/next/include/chpl/uast/Scan.h

A compiler/next/include/chpl/uast/TypeQuery.h
A compiler/next/include/chpl/uast/VarArgFormal.h
A compiler/next/lib/uast/Scan.cpp
A compiler/next/lib/uast/TypeQuery.cpp
A compiler/next/lib/uast/VarArgFormal.cpp
M compiler/AST/build.cpp
M compiler/include/build.h
M compiler/next/include/chpl/resolution/resolution-types.h
M compiler/next/include/chpl/uast/ASTClassesList.h
M compiler/next/include/chpl/uast/Cobegin.h
M compiler/next/include/chpl/uast/Conditional.h
M compiler/next/include/chpl/uast/Function.h
M compiler/next/include/chpl/uast/MultiDecl.h
M compiler/next/include/chpl/uast/TupleDecl.h
M compiler/next/include/chpl/uast/all-uast.h
M compiler/next/lib/parsing/ParserContext.h
M compiler/next/lib/parsing/ParserContextImpl.h
M compiler/next/lib/parsing/bison-chpl-lib.cpp
M compiler/next/lib/parsing/chpl.ypp
M compiler/next/lib/resolution/resolution-queries.cpp
M compiler/next/lib/resolution/resolution-types.cpp
M compiler/next/lib/uast/CMakeLists.txt
M compiler/next/lib/uast/Conditional.cpp
M compiler/next/lib/uast/Makefile.include
M compiler/next/lib/uast/TupleDecl.cpp
M compiler/next/test/parsing/testParseFunctions.cpp
M compiler/next/test/parsing/testParseTupleVar.cpp
M compiler/parser/parser.cpp
M compiler/passes/convert-uast.cpp

Compare: https://github.com/chapel-lang/chapel/compare/d36dd3f90b3c...3fd03c2372c7