Branch: refs/heads/main
Revision: 61d24c7
Author: mppf
Log Message:
Merge pull request #17974 from mppf/next-improvements
compiler/next: improve structure and visitors
This PR makes several improvements to the compiler/next code.
First, it rearranges a few directories. Since function resolution is a
pretty big portion of the production compiler, it makes sense for it to
have its own directory. Additionally the frontend
directory is not
really that useful since the compiler/next
library might only be the
front-end for the next while. Furthermore the frontend/Parsing
directory seems unnecessarily nested. So it splits frontend
into
parsing
and resolution
. It adds namespaces for these two because they
will contain free functions that we would like to bundle up.
Then, it replaces the Visitor that is so far unused with the methods
dispatch
and traverse
on ASTNode
that are more flexible and (we
think) more elegant. It migrates convert-uast.cpp
over to use the new
dispatch
method rather than some macro stuff.
Finally, it includes two bug fixes:
One improves the behavior for the fileText
and parseFile
queries when
the file is not found. To enable that, adds an isEmpty
to
ErrorMessage
.
The second bug fix addresses problems with saving locations in the
Builder (because when a uAST parse tree is reused we might need some of
the old locations map and some of the new).
A follow-on PR #17977 will add types (which this PR originally included
but I split out).
Reviewed by @stonea and @dlongnecke-cray - thanks!
-
[x] make test-libchplcomp passes (after a parser rebuild)
Modified Files:
A compiler/next/include/chpl/parsing/Parser.h
A compiler/next/include/chpl/parsing/parsing-queries.h
A compiler/next/include/chpl/resolution/resolution-queries.h
A compiler/next/include/chpl/resolution/resolution-types.h
A compiler/next/lib/parsing/CMakeLists.txt
A compiler/next/lib/parsing/Makefile
A compiler/next/lib/parsing/Makefile.include
A compiler/next/lib/parsing/Parser.cpp
A compiler/next/lib/parsing/ParserContext.h
A compiler/next/lib/parsing/ParserContextImpl.h
A compiler/next/lib/parsing/README
A compiler/next/lib/parsing/bison-chpl-lib.cpp
A compiler/next/lib/parsing/bison-chpl-lib.h
A compiler/next/lib/parsing/chpl.lex
A compiler/next/lib/parsing/chpl.ypp
A compiler/next/lib/parsing/flex-chpl-lib.cpp
A compiler/next/lib/parsing/flex-chpl-lib.h
A compiler/next/lib/parsing/lexer-help.h
A compiler/next/lib/parsing/parser-dependencies.h
A compiler/next/lib/parsing/parser-help.h
A compiler/next/lib/parsing/parsing-queries.cpp
A compiler/next/lib/resolution/CMakeLists.txt
A compiler/next/lib/resolution/Makefile
A compiler/next/lib/resolution/Makefile.include
A compiler/next/lib/resolution/resolution-queries.cpp
A compiler/next/lib/resolution/resolution-types.cpp
A compiler/next/test/parsing/CMakeLists.txt
A compiler/next/test/parsing/testParse.cpp
A compiler/next/test/parsing/testParseAggregate.cpp
A compiler/next/test/parsing/testParseBegin.cpp
A compiler/next/test/parsing/testParseBracketLoop.cpp
A compiler/next/test/parsing/testParseCobegin.cpp
A compiler/next/test/parsing/testParseCoforall.cpp
A compiler/next/test/parsing/testParseConditional.cpp
A compiler/next/test/parsing/testParseDefer.cpp
A compiler/next/test/parsing/testParseDelete.cpp
A compiler/next/test/parsing/testParseDoWhile.cpp
A compiler/next/test/parsing/testParseEnums.cpp
A compiler/next/test/parsing/testParseFor.cpp
A compiler/next/test/parsing/testParseForall.cpp
A compiler/next/test/parsing/testParseForeach.cpp
A compiler/next/test/parsing/testParseFunctions.cpp
A compiler/next/test/parsing/testParseLabelContinueBreak.cpp
A compiler/next/test/parsing/testParseLocal.cpp
A compiler/next/test/parsing/testParseModules.cpp
A compiler/next/test/parsing/testParseMultiVar.cpp
A compiler/next/test/parsing/testParseNew.cpp
A compiler/next/test/parsing/testParseNumericLiterals.cpp
A compiler/next/test/parsing/testParseOn.cpp
A compiler/next/test/parsing/testParseReturn.cpp
A compiler/next/test/parsing/testParseSerial.cpp
A compiler/next/test/parsing/testParseStringBytesLiterals.cpp
A compiler/next/test/parsing/testParseSync.cpp
A compiler/next/test/parsing/testParseTupleVar.cpp
A compiler/next/test/parsing/testParseUse.cpp
A compiler/next/test/parsing/testParseWhile.cpp
A compiler/next/test/parsing/testParseYield.cpp
A compiler/next/test/parsing/testParsingQueries.cpp
A compiler/next/test/resolution/CMakeLists.txt
A compiler/next/test/resolution/testInteractive.cpp
A compiler/next/test/resolution/testResolve.cpp
A compiler/next/test/uast/testVisit.cpp
R compiler/next/include/chpl/frontend/Parser.h
R compiler/next/include/chpl/frontend/frontend-queries.h
R compiler/next/include/chpl/uast/Visitor.h
R compiler/next/lib/frontend/CMakeLists.txt
R compiler/next/lib/frontend/Makefile
R compiler/next/lib/frontend/Makefile.include
R compiler/next/lib/frontend/Parser.cpp
R compiler/next/lib/frontend/Parser/CMakeLists.txt
R compiler/next/lib/frontend/Parser/Makefile
R compiler/next/lib/frontend/Parser/Makefile.include
R compiler/next/lib/frontend/Parser/ParserContext.h
R compiler/next/lib/frontend/Parser/ParserContextImpl.h
R compiler/next/lib/frontend/Parser/README
R compiler/next/lib/frontend/Parser/bison-chpl-lib.cpp
R compiler/next/lib/frontend/Parser/bison-chpl-lib.h
R compiler/next/lib/frontend/Parser/chpl.lex
R compiler/next/lib/frontend/Parser/chpl.ypp
R compiler/next/lib/frontend/Parser/flex-chpl-lib.cpp
R compiler/next/lib/frontend/Parser/flex-chpl-lib.h
R compiler/next/lib/frontend/Parser/lexer-help.h
R compiler/next/lib/frontend/Parser/parser-dependencies.h
R compiler/next/lib/frontend/Parser/parser-help.h
R compiler/next/lib/frontend/frontend-queries.cpp
R compiler/next/lib/uast/Visitor.cpp
R compiler/next/test/frontend/CMakeLists.txt
R compiler/next/test/frontend/testFrontendQueries.cpp
R compiler/next/test/frontend/testInteractive.cpp
R compiler/next/test/frontend/testParse.cpp
R compiler/next/test/frontend/testParseAggregate.cpp
R compiler/next/test/frontend/testParseBegin.cpp
R compiler/next/test/frontend/testParseBracketLoop.cpp
R compiler/next/test/frontend/testParseCobegin.cpp
R compiler/next/test/frontend/testParseCoforall.cpp
R compiler/next/test/frontend/testParseConditional.cpp
R compiler/next/test/frontend/testParseDefer.cpp
R compiler/next/test/frontend/testParseDelete.cpp
R compiler/next/test/frontend/testParseDoWhile.cpp
R compiler/next/test/frontend/testParseEnums.cpp
R compiler/next/test/frontend/testParseFor.cpp
R compiler/next/test/frontend/testParseForall.cpp
R compiler/next/test/frontend/testParseForeach.cpp
R compiler/next/test/frontend/testParseFunctions.cpp
R compiler/next/test/frontend/testParseLabelContinueBreak.cpp
R compiler/next/test/frontend/testParseLocal.cpp
R compiler/next/test/frontend/testParseModules.cpp
R compiler/next/test/frontend/testParseMultiVar.cpp
R compiler/next/test/frontend/testParseNew.cpp
R compiler/next/test/frontend/testParseNumericLiterals.cpp
R compiler/next/test/frontend/testParseOn.cpp
R compiler/next/test/frontend/testParseReturn.cpp
R compiler/next/test/frontend/testParseSerial.cpp
R compiler/next/test/frontend/testParseStringBytesLiterals.cpp
R compiler/next/test/frontend/testParseSync.cpp
R compiler/next/test/frontend/testParseTupleVar.cpp
R compiler/next/test/frontend/testParseUse.cpp
R compiler/next/test/frontend/testParseWhile.cpp
R compiler/next/test/frontend/testParseYield.cpp
R compiler/next/test/frontend/testResolve.cpp
M compiler/Makefile
M compiler/include/convert-uast.h
M compiler/next/Makefile.help
M compiler/next/README
M compiler/next/include/chpl/queries/ErrorMessage.h
M compiler/next/include/chpl/queries/Location.h
M compiler/next/include/chpl/uast/ASTClassesList.h
M compiler/next/include/chpl/uast/ASTNode.h
M compiler/next/include/chpl/uast/Builder.h
M compiler/next/lib/CMakeLists.txt
M compiler/next/lib/uast/Builder.cpp
M compiler/next/lib/uast/CMakeLists.txt
M compiler/next/lib/uast/Makefile.include
M compiler/next/test/CMakeLists.txt
M compiler/next/test/uast/CMakeLists.txt
M compiler/next/test/uast/testBuildIDs.cpp
M compiler/parser/parser.cpp
M compiler/passes/convert-uast.cpp
M compiler/util/astlocs.cpp
M util/test/checkCopyrights.bashCompare: Comparing 33976fe15fed...61d24c7d43bb · chapel-lang/chapel · GitHub