From c0970aac1ebeef8287594769aa71c9f36bca92bd Mon Sep 17 00:00:00 2001 From: Muqiu Han Date: Sat, 23 Mar 2024 18:11:16 +0800 Subject: [PATCH 1/4] [swallow]: Use clang and libc++ by default toolchain --- README | 55 ++++++++++++++++++++++++++++ {stdlib => base}/stdlib.cpp | 0 base/xmake.lua | 5 +++ compiler/ast/ast.hpp | 11 +++--- compiler/diagnostics/diagnostics.cpp | 16 ++++---- compiler/diagnostics/diagnostics.h | 32 ++++++++-------- compiler/diagnostics/termcolor.hpp | 44 +++++++++++----------- compiler/g-machine/binop.cpp | 12 ++++-- compiler/g-machine/binop.hpp | 8 ++-- compiler/g-machine/environment.cpp | 4 +- compiler/g-machine/environment.hpp | 8 ++-- compiler/parser/parser.h | 4 +- compiler/type/type.cpp | 4 +- compiler/utils/result/result.hpp | 4 +- compiler/xmake.lua | 6 +-- repl/xmake.lua | 3 +- stdlib/xmake.lua | 4 -- 17 files changed, 139 insertions(+), 81 deletions(-) create mode 100644 README rename {stdlib => base}/stdlib.cpp (100%) create mode 100644 base/xmake.lua delete mode 100644 stdlib/xmake.lua diff --git a/README b/README new file mode 100644 index 0000000..3916df0 --- /dev/null +++ b/README @@ -0,0 +1,55 @@ +* Swallow +* A minimalist functional programming language +* Copyright (c) 2023 Muqiu Han +* +* This project is built using xmake: https://xmake.io/ +* +* FAQ: https://github.com/muqiuhan/Swallow/blob/main/FAQ +* Issues: https://github.com/muqiuhan/Swallow/issues +* Contribution: https://github.com/muqiuhan/Swallow/pulls + + +To build and run with xmake: + + setup: Install the xmake, flex and bison + To build: xmake build + To run: xmake run + To install: xmake install + + +Features +---------- +o- Typechecking +o- Pattern match +o- Garbage Collection +o- Polymorphism + +LICENSE +---------- +Copyright (c) 2023 Muqiu Han + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Terifo nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/stdlib/stdlib.cpp b/base/stdlib.cpp similarity index 100% rename from stdlib/stdlib.cpp rename to base/stdlib.cpp diff --git a/base/xmake.lua b/base/xmake.lua new file mode 100644 index 0000000..6a1057b --- /dev/null +++ b/base/xmake.lua @@ -0,0 +1,5 @@ +target("base") + set_kind("shared") + set_languages("c++20") + add_files("*.cpp") + add_cxxflags("clang::-stdlib=libc++") \ No newline at end of file diff --git a/compiler/ast/ast.hpp b/compiler/ast/ast.hpp index 6b65956..0621988 100644 --- a/compiler/ast/ast.hpp +++ b/compiler/ast/ast.hpp @@ -54,10 +54,9 @@ namespace swallow::compiler::ast explicit AST(const yy::location Location) : Location(Location) {} virtual ~AST() = default; - virtual auto - typecheck(type::Manager &typeManager, - const type::Environment &typeEnvironment) const noexcept - -> utils::Result = 0; + virtual auto typecheck(type::Manager &typeManager, + const type::Environment &typeEnvironment) + const noexcept -> utils::Result = 0; virtual void dump(uint8_t indent, std::ostream &to) const noexcept = 0; @@ -205,8 +204,8 @@ namespace swallow::compiler::ast , AST(Location) {} - static auto operatorsToString(const utils::Binop op) noexcept - -> std::string; + static auto + operatorsToString(const utils::Binop op) noexcept -> std::string; auto typecheck(type::Manager &typeManager, const type::Environment &typeEnvironment) const noexcept diff --git a/compiler/diagnostics/diagnostics.cpp b/compiler/diagnostics/diagnostics.cpp index 998fb7a..6e6fd1d 100644 --- a/compiler/diagnostics/diagnostics.cpp +++ b/compiler/diagnostics/diagnostics.cpp @@ -55,8 +55,8 @@ namespace swallow::compiler::diagnostics } } - auto color_by_type(std::ostream &stream, const ColorType type) - -> std::ostream & + auto color_by_type(std::ostream &stream, + const ColorType type) -> std::ostream & { switch (type) { @@ -305,8 +305,8 @@ namespace swallow::compiler::diagnostics auto Details::get_path() const -> const std::string & { return this->path_; } - LabelGroup::LabelGroup( - Details *general_details_, std::vector labels) + LabelGroup::LabelGroup(Details *general_details_, + std::vector labels) : first_label_() , last_label_() , details_(general_details_) @@ -540,8 +540,8 @@ namespace swallow::compiler::diagnostics output << termcolor::reset << "\n"; } - auto LabelGroup::find_label_levels(const Labels &labels) - -> std::vector + auto + LabelGroup::find_label_levels(const Labels &labels) -> std::vector { auto descending_labels(labels); std::sort(descending_labels.begin(), descending_labels.end(), @@ -811,8 +811,8 @@ namespace swallow::compiler::diagnostics ReportBuilder::ReportBuilder() = default; - auto ReportBuilder::with_message(const std::string &message) - -> ReportBuilder & + auto + ReportBuilder::with_message(const std::string &message) -> ReportBuilder & { this->message_ = message; return *this; diff --git a/compiler/diagnostics/diagnostics.h b/compiler/diagnostics/diagnostics.h index 7b1b09a..0620a8b 100644 --- a/compiler/diagnostics/diagnostics.h +++ b/compiler/diagnostics/diagnostics.h @@ -42,8 +42,8 @@ namespace swallow::compiler::diagnostics auto get_color_by_name(const std::string &name) -> ColorType; - auto print_formatted_text(std::ostream &output, const std::string &text) - -> void; + auto print_formatted_text(std::ostream &output, + const std::string &text) -> void; class Label; @@ -82,8 +82,8 @@ namespace swallow::compiler::diagnostics Label(std::optional message, const Span &span, ColorType color_type); - [[nodiscard]] auto get_message() const - -> const std::optional &; + [[nodiscard]] auto + get_message() const -> const std::optional &; [[nodiscard]] auto get_span() const -> const Span &; @@ -136,8 +136,8 @@ namespace swallow::compiler::diagnostics [[nodiscard]] auto get_label_line(const Label &label) const -> size_t; - [[nodiscard]] auto get_line_spans() const - -> const std::vector> &; + [[nodiscard]] auto + get_line_spans() const -> const std::vector> &; [[nodiscard]] auto get_source() const -> const std::string &; @@ -156,8 +156,8 @@ namespace swallow::compiler::diagnostics public: LabelGroup(Details *general_details, Labels labels); - auto print(std::ostream &output, const std::string &spaces_prefix) const - -> void; + auto print(std::ostream &output, + const std::string &spaces_prefix) const -> void; static auto print_labels_level(const std::vector &level_labels, size_t current_level, const Span &line_span, @@ -167,11 +167,11 @@ namespace swallow::compiler::diagnostics auto print_colored_source_line(std::ostream &output, const Span &label_span, const Labels &labels) const -> void; - [[nodiscard]] static auto find_label_levels(const Labels &labels) - -> std::vector; + [[nodiscard]] static auto + find_label_levels(const Labels &labels) -> std::vector; - [[nodiscard]] static auto find_remove_overlapping_labels(Labels &labels) - -> Labels; + [[nodiscard]] static auto + find_remove_overlapping_labels(Labels &labels) -> Labels; [[nodiscard]] auto find_labels_in_line(size_t line_index) const -> Labels; @@ -195,13 +195,13 @@ namespace swallow::compiler::diagnostics public: FileGroup(Details *details, Labels labels); - auto print(std::ostream &output, const std::string &spaces_prefix) const - -> void; + auto print(std::ostream &output, + const std::string &spaces_prefix) const -> void; [[nodiscard]] auto get_biggest_displayed_number() const -> size_t; - [[nodiscard]] auto get_label_groups() const - -> const std::vector &; + [[nodiscard]] auto + get_label_groups() const -> const std::vector &; [[nodiscard]] auto get_details() const -> Details *; diff --git a/compiler/diagnostics/termcolor.hpp b/compiler/diagnostics/termcolor.hpp index 3c14462..383a610 100644 --- a/compiler/diagnostics/termcolor.hpp +++ b/compiler/diagnostics/termcolor.hpp @@ -69,16 +69,16 @@ namespace termcolor } // namespace _internal template - auto colorize(std::basic_ostream &stream) - -> std::basic_ostream & + auto + colorize(std::basic_ostream &stream) -> std::basic_ostream & { stream.iword(_internal::colorize_index()) = 1L; return stream; } template - auto nocolorize(std::basic_ostream &stream) - -> std::basic_ostream & + auto + nocolorize(std::basic_ostream &stream) -> std::basic_ostream & { stream.iword(_internal::colorize_index()) = 0L; return stream; @@ -138,8 +138,8 @@ namespace termcolor } template - auto underline(std::basic_ostream &stream) - -> std::basic_ostream & + auto + underline(std::basic_ostream &stream) -> std::basic_ostream & { if (_internal::is_colorized(stream)) { @@ -179,8 +179,8 @@ namespace termcolor } template - auto concealed(std::basic_ostream &stream) - -> std::basic_ostream & + auto + concealed(std::basic_ostream &stream) -> std::basic_ostream & { if (_internal::is_colorized(stream)) { @@ -219,8 +219,8 @@ namespace termcolor } template - auto on_color(std::basic_ostream &stream) - -> std::basic_ostream & + auto + on_color(std::basic_ostream &stream) -> std::basic_ostream & { if (_internal::is_colorized(stream)) { @@ -246,8 +246,8 @@ namespace termcolor } template - auto on_color(std::basic_ostream &stream) - -> std::basic_ostream & + auto + on_color(std::basic_ostream &stream) -> std::basic_ostream & { if (_internal::is_colorized(stream)) { @@ -396,8 +396,8 @@ namespace termcolor } template - auto bright_red(std::basic_ostream &stream) - -> std::basic_ostream & + auto + bright_red(std::basic_ostream &stream) -> std::basic_ostream & { if (_internal::is_colorized(stream)) { @@ -540,8 +540,8 @@ namespace termcolor } template - auto on_green(std::basic_ostream &stream) - -> std::basic_ostream & + auto + on_green(std::basic_ostream &stream) -> std::basic_ostream & { if (_internal::is_colorized(stream)) { @@ -555,8 +555,8 @@ namespace termcolor } template - auto on_yellow(std::basic_ostream &stream) - -> std::basic_ostream & + auto + on_yellow(std::basic_ostream &stream) -> std::basic_ostream & { if (_internal::is_colorized(stream)) { @@ -585,8 +585,8 @@ namespace termcolor } template - auto on_magenta(std::basic_ostream &stream) - -> std::basic_ostream & + auto + on_magenta(std::basic_ostream &stream) -> std::basic_ostream & { if (_internal::is_colorized(stream)) { @@ -616,8 +616,8 @@ namespace termcolor } template - auto on_white(std::basic_ostream &stream) - -> std::basic_ostream & + auto + on_white(std::basic_ostream &stream) -> std::basic_ostream & { if (_internal::is_colorized(stream)) { diff --git a/compiler/g-machine/binop.cpp b/compiler/g-machine/binop.cpp index 3ee9159..bac633e 100644 --- a/compiler/g-machine/binop.cpp +++ b/compiler/g-machine/binop.cpp @@ -32,8 +32,8 @@ namespace swallow::compiler::gmachine { - [[nodiscard]] auto Binop::operatorsToString(utils::Binop op) noexcept - -> std::string + [[nodiscard]] auto + Binop::operatorsToString(utils::Binop op) noexcept -> std::string { switch (op) { @@ -46,10 +46,12 @@ namespace swallow::compiler::gmachine case utils::Binop::DIVIDE: return {"/"}; } + + utils::panic("ICE: operatorsToString"); } - [[nodiscard]] auto Binop::operatorsAction(utils::Binop op) noexcept - -> std::string + [[nodiscard]] auto + Binop::operatorsAction(utils::Binop op) noexcept -> std::string { switch (op) { @@ -62,5 +64,7 @@ namespace swallow::compiler::gmachine case utils::Binop::DIVIDE: return {"divide"}; } + + utils::panic("ICE: operatorsToString"); } } // namespace swallow::compiler::gmachine \ No newline at end of file diff --git a/compiler/g-machine/binop.hpp b/compiler/g-machine/binop.hpp index 570502c..5627501 100644 --- a/compiler/g-machine/binop.hpp +++ b/compiler/g-machine/binop.hpp @@ -38,10 +38,10 @@ namespace swallow::compiler::gmachine class Binop { public: - [[nodiscard]] static auto operatorsToString(const utils::Binop op) noexcept - -> std::string; - [[nodiscard]] static auto operatorsAction(const utils::Binop op) noexcept - -> std::string; + [[nodiscard]] static auto + operatorsToString(const utils::Binop op) noexcept -> std::string; + [[nodiscard]] static auto + operatorsAction(const utils::Binop op) noexcept -> std::string; }; } // namespace swallow::compiler::gmachine diff --git a/compiler/g-machine/environment.cpp b/compiler/g-machine/environment.cpp index 285929f..980c748 100644 --- a/compiler/g-machine/environment.cpp +++ b/compiler/g-machine/environment.cpp @@ -58,8 +58,8 @@ namespace swallow::compiler::gmachine return false; } - [[nodiscard]] auto Offset::hasVariable(const std::string &name) const noexcept - -> bool + [[nodiscard]] auto + Offset::hasVariable(const std::string &name) const noexcept -> bool { if (Parent != nullptr) return Parent->hasVariable(name); diff --git a/compiler/g-machine/environment.hpp b/compiler/g-machine/environment.hpp index f5fe787..6deae78 100644 --- a/compiler/g-machine/environment.hpp +++ b/compiler/g-machine/environment.hpp @@ -64,8 +64,8 @@ namespace swallow::compiler::gmachine [[nodiscard]] auto getOffset(const std::string &name) const noexcept -> tl::optional override; - [[nodiscard]] auto hasVariable(const std::string &name) const noexcept - -> bool override; + [[nodiscard]] auto + hasVariable(const std::string &name) const noexcept -> bool override; }; class Offset : public Environment @@ -81,8 +81,8 @@ namespace swallow::compiler::gmachine [[nodiscard]] auto getOffset(const std::string &name) const noexcept -> tl::optional override; - [[nodiscard]] auto hasVariable(const std::string &name) const noexcept - -> bool override; + [[nodiscard]] auto + hasVariable(const std::string &name) const noexcept -> bool override; }; } // namespace swallow::compiler::gmachine diff --git a/compiler/parser/parser.h b/compiler/parser/parser.h index df14266..5a98b72 100644 --- a/compiler/parser/parser.h +++ b/compiler/parser/parser.h @@ -35,8 +35,8 @@ namespace swallow::compiler::parser { - auto parse() noexcept - -> std::vector &; + auto + parse() noexcept -> std::vector &; } // namespace swallow::compiler::parser diff --git a/compiler/type/type.cpp b/compiler/type/type.cpp index a89b8d0..6dd74c3 100644 --- a/compiler/type/type.cpp +++ b/compiler/type/type.cpp @@ -78,8 +78,8 @@ namespace swallow::compiler::type return type; } - auto Manager::unify(Type::Ptr left, Type::Ptr right) noexcept - -> Result + auto Manager::unify(Type::Ptr left, + Type::Ptr right) noexcept -> Result { Variable *leftVar = nullptr; Variable *rightVar = nullptr; diff --git a/compiler/utils/result/result.hpp b/compiler/utils/result/result.hpp index 22ac4ba..bc0fee6 100644 --- a/compiler/utils/result/result.hpp +++ b/compiler/utils/result/result.hpp @@ -231,8 +231,8 @@ namespace swallow::compiler::utils // This function can be used to unpack a successful result while handling an // error. template - auto map_or_else(ErrorFunction err_fn, OkFunction ok_fn) - -> decltype(ok_fn(T())) + auto map_or_else(ErrorFunction err_fn, + OkFunction ok_fn) -> decltype(ok_fn(T())) { if (is_ok()) return ok_fn(unwrap()); diff --git a/compiler/xmake.lua b/compiler/xmake.lua index 569f89e..41e9d3b 100644 --- a/compiler/xmake.lua +++ b/compiler/xmake.lua @@ -2,7 +2,7 @@ set_project("swallow") set_version("0.0.1") set_xmakever("2.8.1") -includes("../stdlib") +includes("../base") target("swc") set_kind("binary") @@ -12,8 +12,6 @@ target("swc") add_files("*.cpp", "**/*.cpp") add_includedirs(".", "ast", "type", "lexer", "parser", "diagnostics", "utils") - add_links("c++") - before_build(function (target) os.run("flex -o $(scriptdir)/lexer/flex_lexer.cpp $(scriptdir)/lexer/lexer.l") os.run("bison -o $(scriptdir)/parser/bison_parser.cpp -d $(scriptdir)/parser/parser.y") @@ -23,4 +21,4 @@ target("swc") os.run("sh after_build.sh") end) - add_deps("stdlib") \ No newline at end of file + add_deps("base") \ No newline at end of file diff --git a/repl/xmake.lua b/repl/xmake.lua index d8ee0ec..311dfaf 100644 --- a/repl/xmake.lua +++ b/repl/xmake.lua @@ -4,4 +4,5 @@ target("swi") set_kind("binary") set_languages("c++20") add_files("*.cpp") - add_deps("swc") \ No newline at end of file + add_deps("swc") + add_cxxflags("clang::-stdlib=libc++") \ No newline at end of file diff --git a/stdlib/xmake.lua b/stdlib/xmake.lua deleted file mode 100644 index 0af1893..0000000 --- a/stdlib/xmake.lua +++ /dev/null @@ -1,4 +0,0 @@ -target("stdlib") - set_kind("shared") - set_languages("c++20") - add_files("*.cpp") \ No newline at end of file From 77e844e6f1b55d2aaa47f59aa45a2f64d14b5a48 Mon Sep 17 00:00:00 2001 From: Muqiu Han Date: Fri, 29 Mar 2024 20:31:19 +0800 Subject: [PATCH 2/4] [swallow]: Add etags file --- TAGS | 2129 +++++++++++++++++ compiler/ast/dump.cpp | 2 +- compiler/ast/g-machine.cpp | 2 +- compiler/diagnostics/diagnostics.cpp | 7 +- compiler/{g-machine => }/environment.cpp | 0 compiler/{g-machine => lexer}/instruction.hpp | 0 compiler/xmake.lua | 1 - 7 files changed, 2135 insertions(+), 6 deletions(-) create mode 100644 TAGS rename compiler/{g-machine => }/environment.cpp (100%) rename compiler/{g-machine => lexer}/instruction.hpp (100%) diff --git a/TAGS b/TAGS new file mode 100644 index 0000000..4967ea0 --- /dev/null +++ b/TAGS @@ -0,0 +1,2129 @@ + +.git/hooks/applypatch-msg.sample,18 +commitmsg=13,367 + +.git/hooks/fsmonitor-watchman.sample,740 +my ($version, $last_update_token)($version, $last_update_token19,619 +my $git_work_tree git_work_tree30,902 +my $retry retry32,942 +my $json_pkg;json_pkg34,958 +sub launch_watchman 46,1105 + my $o o47,1127 +sub output_result 53,1239 + my ($clockid, @files)($clockid, @files54,1259 + local $,65,1514 +sub watchman_clock 69,1550 + my $response response70,1571 +sub watchman_query 77,1778 + my $pid pid78,1799 + my $last_update_line last_update_line89,2316 + my $query query94,2502 + my $response response108,2826 +sub is_work_tree_watched 123,3285 + my ($output)($output124,3312 + my $error error125,3332 + my $response response128,3478 + my $o o144,4158 +sub get_working_dir 163,4500 + my $working_dir;working_dir164,4522 + +.git/hooks/pre-applypatch.sample,18 +precommit=12,313 + +.git/hooks/pre-push.sample,15 +remote=22,768 + +.git/hooks/pre-rebase.sample,16 +publish=18,587 + +.git/hooks/pre-receive.sample,12 + i=22,520 + +.git/hooks/prepare-commit-msg.sample,24 +COMMIT_MSG_FILE=23,857 + +.git/hooks/push-to-checkout.sample,15 +commit=21,927 + +.git/hooks/sendemail-validate.sample,78 +validate_cover_letter 25,887 +validate_patch 31,998 +validate_series 40,1200 + +.git/hooks/update.sample,78 +refname=28,929 +allowunannotated=46,1315 +zero=63,1921 + newrev_type=65,2017 + +.git/description,24 +Unnamed repository;1,0 + +.git/objects/pack/pack-252cc42187dba9eb9e7479580c0f96d43ca20a5f.pack,1739 +0EYś4i""ĉ+bmjPݽu N.W^(OHcS+c0EvbhȀAV(1hl|j䲉"O"eGZ^mpp)ܥ܅h%l mWn.-=7tma&ȟ1/ÇJxN0D|Nt4|X{ל9>'Ahfތf*;;hF{;jt&TgG08uZ%WfhްFzTz*+<2-;NJ/=(P Q nmk߹{RJzGf1\$*U7|Xx˱n ᝧjalsQe1Sဣ!ua'}n>o$dM:fXȏx'څ(xT7ޥ4 =$Zrg B zc|ޮusY;s/_\N\kpAh'"Z=Z7,1164 +{hj"{" `6GG6573,1671996 +Dt_v/e(S2i7Lس;2@݊NYLеb:eIt90r%ҹp,>{hj"{" `6G˞=hi qfЎ"JW/B 7?"^Ϭӽgx}MT.w&Co+ d5 Dȓ +lvΗQ1B8$uҟF!T낊fCO܃$O&}I7Eܤ,,%ss6573,1671996 +DBmDB6580,1673827 +DBm]eZ w61,jwhkEXv*- wyzBO3+û '֞'}Wj#9X\/W,Tb^ң|QQ6580,1673827 +:9C%AJ>y v8Úh-4(l PE3gj-wfM>R,TfNKTfNK6584,1675618 + +.git/objects/pack/pack-252cc42187dba9eb9e7479580c0f96d43ca20a5f.idx,412 +S巴<;sdj bew5$gQDmّ_(ةoש f+ܤ7QռI6Y.CX\y0X̪pn.  "xx8,2161 +3 i֮|PĕP9,2370 +3 i֮|PĕXȼ]w rP4rP9,2370 +K  F#{|}qP]qP25,3094 +aUVaUV28,3757 +Tpg~Po*}o|_ ^ni3.Ʒt.qC]K:*!AΫ7\Lޔ1bޙ*y+*&AA34,4985 + +.git/config,30 + repositoryformatversion 2,7 + +.git/index,11 +R]R3,765 + +CMakeLists.txt,30 +cmake_minimum_required(6,128 + +LICENSE,15 +Copyright 1,0 + +README,19 +* Copyright 3,59 + +README.md,16 +
utils::Result<utils::Result59,2309 + class Pattern68,2677 + const yy::location Location;73,2750 + explicit Pattern(75,2784 + class Branch84,3112 + const yy::location Location;89,3183 + const Pattern::Ptr Patt;90,3216 + const AST::Ptr Expr;91,3245 + Branch(93,3271 + class Constructor98,3431 + const std::string Name;103,3512 + const std::vector Types;104,3540 + const yy::location Location;105,3582 + Constructor(107,3616 + class Definition113,3815 + const yy::location Location;118,3894 + explicit Definition(120,3928 +namespace swallow::compiler::type349,10979 + +compiler/ast/dump.cpp,365 +namespace swallow::compiler::ast34,1645 + static void printIndent(36,1680 + void Int::dump(dump42,1795 + void LID::dump(dump48,1950 + void UID::dump(dump54,2102 + void Binop::dump(dump60,2254 + void Application::dump(dump72,2524 + void Match::dump(dump83,2761 + void PatternVariable::dump(dump100,3112 + void PatternConstructor::dump(dump105,3203 + +compiler/ast/g-machine.cpp,272 +namespace swallow::compiler::ast37,1780 + void Int::compile(compile39,1815 + void LID::compile(compile45,2018 + void UID::compile(compile56,2459 + Application::compile(compile63,2669 + void Binop::compile(compile67,2831 + void Match::compile(compile79,3309 + +compiler/ast/type.cpp,539 +namespace swallow::compiler::ast42,1834 + -> Result<Result47,1999 + -> Result<Result54,2229 + -> Result<Result67,2762 + -> Result<Result79,3284 + const noexcept -> Result<Result144,5715 + -> Result<Result193,7545 + void PatternVariable::match(match256,9932 + PatternConstructor::match(match263,10147 + void Fn::scanDefinitionType(scanDefinitionType319,12281 + void Fn::typecheck(typecheck334,12822 + void Data::scanDefinitionType(scanDefinitionType375,14447 + void Data::typecheck(typecheck391,15080 + +compiler/compiler.cpp,48 +auto main(int argc, char **argv) -> int38,1727 + +compiler/compiler.h,187 +#define SWALLOW_COMPILER_COMPILER_H31,1624 + class CompileUnit39,1730 + const std::string FileValue;42,1764 + const std::string FilePath;43,1797 + explicit CompileUnit(47,1878 + +compiler/diagnostics/LICENSE,519 + TERMS AND CONDITIONS FOR USE,5,158 + TERMS AND CONDITIONS FOR USE, REPRODUCTION,5,158 + Derivative Works a copy of this License; and95,5260 + documentation, if provided along with the Derivative Works; or,113,6244 + within a display generated by the Derivative Works,114,6318 + Unless required by applicable law or agreed to in writing,197,11036 + distributed under the License is distributed on an "AS IS" BASIS,198,11107 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,199,11176 + +compiler/diagnostics/code.hpp,720 +#define SWALLOW_COMPILER_DIAGNOSTICS_CODE_HPP31,1634 +namespace swallow::compiler::diagnostics34,1700 + enum Code 37,1744 + UNKNOWN,39,1771 + PARSING,40,1784 + LID_NOT_DECLARED,41,1797 + UID_NOT_DECLARED,42,1819 + EXPR_TYPE_CHECKING_FAILED,43,1841 + BINOP_NOT_DECLARED,44,1872 + BINOP_TYPE_MISMATCH,45,1896 + APPLICATION_TYPE_MISMATCH,46,1921 + MATCH_EXPR_TYPE_CHECKING_FAILED,47,1952 + MATCH_EXPR_BRANCHE_TYPE_CONFLICTS,48,1989 + MATCH_EXPR_CURRENT_BRANCHE_TYPE_CHECKING_FAILED,49,2028 + MATCH_NON_DATA_TYPE,50,2081 + PATTERN_CONSTRUCTOR_IS_NOT_FUNCTION,51,2106 + PATTERN_MISMATCH,52,2147 + FUNCTION_BODY_TYPE_CHECKING_FAILED,53,2169 + CONSTRUCTOR_NOT_DECLARED,54,2209 + +compiler/diagnostics/diagnostics.h,3948 +#define SWALLOW_COMPILER_DIAGNOSTICS_DIAGNOSTICS_H2,51 +#define COLOR_BY_TYPE(10,197 +#define COLOR_RGB(12,339 +#define assertm(14,419 + enum class ReportType19,516 + ERROR,21,544 + INFO,22,555 + WARNING,23,565 + enum class ColorType30,710 + DEFAULT,32,737 + RED,33,750 + GREEN,34,759 + BLUE,35,770 + ORANGE,36,780 + YELLOW,37,792 + AQUA38,804 + class Span52,1110 + [[nodiscard]] auto relative_to(const Span &span) const -> Span;59,1217 + [[nodiscard]] auto is_inside_span(const Span &span) const -> bool;61,1286 + [[nodiscard]] auto get_start_index() const -> size_t;63,1358 + [[nodiscard]] auto get_details() const -> Details 65,1417 + [[nodiscard]] auto get_end_index() const -> size_t;67,1475 + [[nodiscard]] auto get_width() const -> size_t;71,1575 + size_t start_index_;74,1639 + Details *details_;details_75,1664 + size_t end_index_;76,1687 + class Label79,1716 + [[nodiscard]] auto get_color() const -> ColorType;90,1989 + [[nodiscard]] auto get_line() const -> size_t;92,2045 + std::optional message_;95,2108 + ColorType color_;96,2149 + size_t line_;97,2171 + Span span_;98,2189 + class LabelBuilder101,2211 + auto build() -> Label;112,2451 + std::optional message_;115,2490 + std::optional color_;116,2531 + std::optional span_;117,2568 + struct AscendingLabels120,2605 + auto operator()(const Label *first, const Label *second) const -> bool;122,2634 + struct DescendingLabels125,2716 + auto operator()(const Label *first, const Label *second) const -> bool;127,2746 + class Details130,2828 + [[nodiscard]] auto get_line_source(const Span &span) const -> std::string;135,2910 + [[nodiscard]] auto get_label_line(const Label &label) const -> size_t;137,2990 + std::vector> line_spans_;147,3309 + std::string source_;148,3361 + std::string path_;149,3386 + class LabelGroup154,3461 + const std::string &spaces_prefix) const -> void;160,3589 + const std::string &spaces_prefix) -> void;165,3867 + const Labels &labels) const -> void;168,4027 + find_label_levels(const Labels &labels) -> std::vector<std::vector171,4130 + find_remove_overlapping_labels(Labels &labels) -> Labels;174,4231 + [[nodiscard]] auto find_labels_in_line(size_t line_index) const -> Labels;176,4296 + [[nodiscard]] auto get_first_label() const -> const Label 178,4376 + [[nodiscard]] auto get_details() const -> Details 182,4504 + [[nodiscard]] auto get_last_label() const -> const Label 184,4562 + const Label *first_label_;first_label_187,4638 + const Label *last_label_;last_label_188,4669 + Details *details_;details_189,4699 + Labels labels_;190,4722 + class FileGroup193,4748 + const std::string &spaces_prefix) const -> void;199,4866 + [[nodiscard]] auto get_biggest_displayed_number() const -> size_t;201,4931 + [[nodiscard]] auto get_details() const -> Details 206,5094 + std::vector label_groups_;209,5163 + Details *details_;details_210,5206 + class Report213,5235 + auto print(std::ostream &output) const -> void;219,5399 + [[nodiscard]] auto find_file_groups() const -> std::vector<std::vector221,5452 + [[nodiscard]] auto get_type() const -> ReportType;229,5750 + [[nodiscard]] auto get_code() const -> size_t;231,5806 + std::optional note_;234,5869 + std::vector