From 9a013c53d4388c3125a677255178cd19311ec31f Mon Sep 17 00:00:00 2001 From: saqut Date: Wed, 27 May 2026 10:29:30 +0300 Subject: [PATCH] Gemini --- CMakeLists.txt | 22 + build/.ninja_deps | Bin 0 -> 29656 bytes build/.ninja_log | 16 + build/CMakeCache.txt | 360 +++++ build/CMakeFiles/4.3.2/CMakeCXXCompiler.cmake | 102 ++ .../4.3.2/CMakeDetermineCompilerABI_CXX.bin | Bin 0 -> 16048 bytes build/CMakeFiles/4.3.2/CMakeSystem.cmake | 15 + .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 949 +++++++++++++ build/CMakeFiles/CMakeConfigureLog.yaml | 1189 +++++++++++++++++ build/CMakeFiles/InstallScripts.json | 7 + build/CMakeFiles/TargetDirectories.txt | 3 + build/CMakeFiles/cmake.check_cache | 1 + build/CMakeFiles/rules.ninja | 96 ++ build/build.ninja | 249 ++++ build/cmake_install.cmake | 66 + fikirler.md => docs/fikirler.md | 0 issues.md => docs/issues.md | 0 prcontext.md => docs/prcontext.md | 0 todo.md => docs/todo.md | 0 Final.sqt => examples/Final.sqt | 0 source.sqt => examples/source.sqt | 0 scripts/build.sh | 9 + compile.sh => scripts/compile.sh | 0 src/core/sourcefile.cpp | 69 + src/core/sourcefile.hpp | 68 +- src/lexer/lexer.cpp | 346 +++++ src/lexer/lexer.hpp | 510 +------ src/parser/ast.hpp | 48 +- src/parser/ast_decl.hpp | 143 -- src/parser/ast_expr.hpp | 287 ---- src/parser/ast_stmt.hpp | 307 ----- src/parser/nodes/binary_expr.cpp | 23 + src/parser/nodes/binary_expr.hpp | 17 + src/parser/nodes/declarations.cpp | 53 + src/parser/nodes/declarations.hpp | 33 + src/parser/nodes/expressions.cpp | 67 + src/parser/nodes/expressions.hpp | 43 + src/parser/nodes/identifier.cpp | 23 + src/parser/nodes/identifier.hpp | 16 + src/parser/nodes/literal.cpp | 34 + src/parser/nodes/literal.hpp | 20 + src/parser/nodes/program.cpp | 26 + src/parser/nodes/program.hpp | 13 + src/parser/nodes/statements.cpp | 140 ++ src/parser/nodes/statements.hpp | 82 ++ src/parser/parser.cpp | 599 +++++++++ src/parser/parser.hpp | 26 - src/parser/parser_core.hpp | 409 ------ src/parser/parser_decl.hpp | 159 --- src/parser/parser_stmt.hpp | 322 ----- src/tokenizer/tokenizer.cpp | 176 +++ src/tokenizer/tokenizer.hpp | 432 +----- 52 files changed, 4894 insertions(+), 2681 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 build/.ninja_deps create mode 100644 build/.ninja_log create mode 100644 build/CMakeCache.txt create mode 100644 build/CMakeFiles/4.3.2/CMakeCXXCompiler.cmake create mode 100755 build/CMakeFiles/4.3.2/CMakeDetermineCompilerABI_CXX.bin create mode 100644 build/CMakeFiles/4.3.2/CMakeSystem.cmake create mode 100644 build/CMakeFiles/4.3.2/CompilerIdCXX/CMakeCXXCompilerId.cpp create mode 100644 build/CMakeFiles/CMakeConfigureLog.yaml create mode 100644 build/CMakeFiles/InstallScripts.json create mode 100644 build/CMakeFiles/TargetDirectories.txt create mode 100644 build/CMakeFiles/cmake.check_cache create mode 100644 build/CMakeFiles/rules.ninja create mode 100644 build/build.ninja create mode 100644 build/cmake_install.cmake rename fikirler.md => docs/fikirler.md (100%) rename issues.md => docs/issues.md (100%) rename prcontext.md => docs/prcontext.md (100%) rename todo.md => docs/todo.md (100%) rename Final.sqt => examples/Final.sqt (100%) rename source.sqt => examples/source.sqt (100%) create mode 100755 scripts/build.sh rename compile.sh => scripts/compile.sh (100%) create mode 100644 src/core/sourcefile.cpp create mode 100644 src/lexer/lexer.cpp delete mode 100644 src/parser/ast_decl.hpp delete mode 100644 src/parser/ast_expr.hpp delete mode 100644 src/parser/ast_stmt.hpp create mode 100644 src/parser/nodes/binary_expr.cpp create mode 100644 src/parser/nodes/binary_expr.hpp create mode 100644 src/parser/nodes/declarations.cpp create mode 100644 src/parser/nodes/declarations.hpp create mode 100644 src/parser/nodes/expressions.cpp create mode 100644 src/parser/nodes/expressions.hpp create mode 100644 src/parser/nodes/identifier.cpp create mode 100644 src/parser/nodes/identifier.hpp create mode 100644 src/parser/nodes/literal.cpp create mode 100644 src/parser/nodes/literal.hpp create mode 100644 src/parser/nodes/program.cpp create mode 100644 src/parser/nodes/program.hpp create mode 100644 src/parser/nodes/statements.cpp create mode 100644 src/parser/nodes/statements.hpp create mode 100644 src/parser/parser.cpp delete mode 100644 src/parser/parser_core.hpp delete mode 100644 src/parser/parser_decl.hpp delete mode 100644 src/parser/parser_stmt.hpp create mode 100644 src/tokenizer/tokenizer.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..37cdcf9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.16) +project(saqut VERSION 0.1 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_compile_options(-Wall -Wextra) + +if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR NOT CMAKE_BUILD_TYPE) + add_compile_options(-g -O0) + message(STATUS "Debug modu aktif") +else() + add_compile_options(-O3) + message(STATUS "Release modu aktif") +endif() + +# Tüm kaynak dosyaları topla +file(GLOB_RECURSE SOURCES "src/*.cpp") + +add_executable(saqut ${SOURCES}) + +target_include_directories(saqut PRIVATE src) diff --git a/build/.ninja_deps b/build/.ninja_deps new file mode 100644 index 0000000000000000000000000000000000000000..2ce38af872bdaf90b1cfbb5d8c86fabbc9536808 GIT binary patch literal 29656 zcmeI)cbF4Z-!R~SNV9H!){=kyIH!59eeM+_uf!ZQS80< z-n(M&&v&0m79+b$qR;dF_j+Bo8#2Fh=FDkxW->{y?ltL}af$L&T|?(~u~=+lwiuNd zpBk2~N;Q-MbN>GD)fCOtNtsxM8})s@!9V*l~q z2!U6ZV8ESF`bJXum# zpDIs{Ev<~j{`g<*ud=T0cX&0Gd5jOTKTg)hAv>=t>#hN5LfN#np8t5O6({3tTcZCp}sVFJ0Z5&f&SFyP*i+x(mz73UhO@;W<%1?@kuTE9h)=!S&KQ1PILaM$YU0V~5?W1Di>r}?% zx~Ok|D1Je8oSc}fOw`9>ABgKVe;r5LN-N)QX`k8tm>!cXsZ5!Y>q{CkiTX?^V(dNf z&FVjjA6r$M$VA8Su9&{_?=LT=#N=C@J>=LsV#8b?&97DIF=Z9WWLZmtziICJYYL8L z-?#sL`b52X=q>46KAv0!DchT3n$>f3JW)%OO-$Eh;;QEjaV;NrHm-V%dd#FkXzX>d z&H8;_p7D5obS(B-filG7!$xkiWohNB1>&+%vDhmG%34*MOjKoy8hg1wY&`x~^h+(p z=8ezPq-3ftqrjy!Hl6q9FI#fbq{NtXJYAE{#OLKvTKTNB&H77T+Rz))HDha^Ddu=86AhK|F_Sa7 z^WD?ZH0!TQie2My0?2&?THKCI>JX}l}a;H6~iN>UX z{g5>C=CjuNO-Pf@r0Nry+WPpIM1$JOP3f@*r7u`t^U^xsMkOt+e4v=J8WDNb6`NB` zn)*adh1FlOx-RM`_y4=&8{1fuj23M76|>LWVa1b`spR<5%Gm|dl&8itR+J?gToZ(u zCECxu(iEIqveQ;{uD(b7;028LmQG30m@r1N*_2k^Esq8EzieP^mbhkX)}~C9;V#>o zjqzw_e+AuHXkW?DrDCx=#5FtjN83s(XSTYZdEGH~drSL?$`Zv`7f00{yRG%S=B=@B zZ8auUQ=U#lYlmA}-Cs7wR1xj)W^o1E*FrBEUV83L1>#eaGG&Hibvl{OOcsBm_yvvQ zR{KLmrqXFAc7yao|4n}i=}Rna5{*@1op8N;n)Q`BF&1Vv$F8%zS^G8^IJRDETeJT7 zSKF0^tCp}Bxkg;G^J-pPc5aJD7ddsQWY}%&YH3>Tqq&`nxvHi8N0)?UQBYZ~n_byb zUfH;L9q|e=&FUf1P~DWrY_L7QJO{zYfY>K-~T(k3Bew?*jNmW&J{d8$7c}5qr zb*cJr#TF{#5^>G?Vt$^XF7x6qZYkgF@mk%dCpDc7E)v(Qj&t>wDUX)Fu?t(uE7Z&1 za*D++5ZBUi=f}BdkJ|Qpu?sw&`SLzbd=dR8YV)`=aH6`j@?2?}9b44rTzr-^q(a|6 zM@+N69eSZ{XWQ1SKVa=)LDs4A^ILwvJ3%!^N&p2tV4 z`&jJs0#*8D-avyn=X%XKD9t>I65c!==e?%TSU90qcl2b7}+OF)AF2=n{;v` z@+5Js)Lk?;l{8qJrOHd12Jnfk#^>i-lBiEsMrA*t)%ffz9iQmFpZg7sHP%s59N%iW zb2VMvmk9-8E6vCYf_Pls@iC2KzZ}(Sx?J7GU03RP)#;j&^2s#`C$XsfM@sjv&OuF8?9Nxn zXhuuN8188`xHA$i5~CK+-WxokrLxX{9g$te#FJHF&6Zt194=k6zB+%pu!_`*VaXfH zb(l2G`f6Sp^{Ifd*rDQ@_0_z%s0k8Pp;Q*+rIm+>|5x=U&%A762N!cp;W{iY(Lu$O zHKbALwG&G#r;Bgar{+I4_r;@gO5WoCz+%$n?z_3b4NL2&PaPm#!FI}B7muy2PljHx ze=%wDuZiqwT7fiSy%t7T-XX=N7DyAdbJ$PRkFq!2rW8tJU`7hTX;e@!S*&Uy8bsH&(9m!ayt zQJR8dCDdVEA|2-4Ofm6|nRHclSsiOA5TCu4i~b+=w|emf>n;0HjL!th0leOt;W zYWRun-HokERAk3ee1UP{o_1ptxKE4wvrfn@0{3n;AB76nU4)wed$p9$U$+Qid)nS? zY)9pe?vqYTxK*`>m}Y%7ifIgcDan3n99`0Bb ztNYBZ1^-$J#$vmOZPqr~bwISgoo#Q{KePLb8n-0+xTUmmCvip0*X8j<_|z~K8{JaA zd1E;AowU!;cNEv`+AG>tTDgO5E!S<+ns=-##Oy`L_C>`G91xsGWe9kszWEyd;6RjR(eMqOH;XH2np$I9 zieFG$%ho;Y>=+r^Qr>y>6*Wz`XCG!WHN1uRX6-kB{NK)XCQbDNs69p>}+9$gz#Z7q`Y~h=*lbsHcsjDcCOaUBiWz*-*M>eI>7KrqoQT zIv#bI4aAOcJb!zxCNH+t`>WXwrw2Lj)MTQ%8&qh&P0MQgTfdlN(+_g%@Oc-T0}JjW zJW=DK-9FY6Td>ZZ*s}@3N+1>+AWgw`&5i|kwM#44EoL9NHX55qrb11vBh3Q)|HSNv z2K~h~n`^S$qIq%cmhy=@UN)#C_tANoxS{{1jiX{T-MNp&O65~F_a*5e_I*vj%)P=ATmjWwCrO5!$d8uS0`d7h{ruPA-9xhJeULnoK- z3N4i*ntQTACDHP}v~u}EaaAdgOqN!56StuDXsmG)H04fqygCu;VL9;y`^n!Dl~yiW zU>{NO!v%0A5k363jQE0mcwT(GuC^+j44+vpU7&2)`vB>RaG%7PYHYZ1zLYfc+N-ta z6;d^!VDaz~fqNTqORI2g9JR-i1@;*oTX-5^k`$Ot2EJhq1Zkhb;NK>rEK1- z&@H<(mA%+}s#25W5&b`;Uqbr9p|2L3J{nuu_2gI&4~IM!m&bzEJmJ<_eL7QFZ9j{N zT~J@kb>k|_%8FXGyQuhreQn+jvUmL!DRv*8>W1Q*-;CHhrgmu zy>NkjMrn1Wqy=+r&Aeo>cGCT${xq*QXZv;NPYX4byVyRNsjaP2>M%*S{iplS&GX^e z@o^2|fy}zPHu7lKE;e0vjXiSW?A;IC^X6`Cyl%@vv}0k~(}9k3qBD!ID2uT;OVEX` zEXh(V%`z;@a)j&Vl6CO25iVigt>4NHf1vgvpGZ9f-rAw$uNd9f{|>+)@;Klwq-lEX9sp< zG&`{~yRa*}u{(RPCws9s`w(Ye5{w~9IpI1mTxa-bD`r^5(u`v~RfM@FJYVV7L`=7c z?T4jN%x%h8hDIhZkx5Ku3R9WJ{v5!8Oy?jD<`53$Fb?MkW^g1&aWuzpEXQ#?CvYMs zaWbcHDyMNeXK*HGaW?00F6VJR7jPjLaWR*0DVK3MS8yd)aW&U)E!S~9H*h02aWl7Y zE4OhwGr5C1xrU62#@j@kMjgi@)S?=4A1f$&+`H=@)9re z3a|1Suk!|P@)mFN4)5|F@ACm4@(~~N37_&ApYsJ@@)ck64RiUH@A#e{_>rIZnP2#o z-}s$B_>(~t_Z=Lc?)VI&D(?$8Bcv_*yqcSbvft;)%S#^r`SZW|E>BZl(exPmQ(j?i z`;UBwUNv`zFt^3pWaqXv{l(9DbS%-BQz5|f$2RHm^%2XG+MIf#QfghM%u!#RQ( z9LZ4}%`qIyaU9PHoXAO>%qg78X`Id(oXJ_7%{iRQd7RG$T*yUS%q3jPWn9h`T**~j z%{5%hbzIL4+{jJb%q`r?ZQRaG?%+=DVitFE5BD;g`?#MuJivoI#KSzoqddmrJi(JZ z#nU{)vpmQ1yugdR#LK+GtGveRyuq8i#oN5YyS&Hye87i%#K(NXr+miee8HD|#n*hp zT)yQyzUK#i_e5_F*}OR^M8 zvkc3!9Nk!+6^`mzRV(vP($p_DS#ra$YjE(2JPfvnFU zHef?GBDC!$Y|3T~W^;zH1w+}AVGL&kBiV|r32i%yZP||P*?}Dy%}(shF6_!~?9LwS z$zJTuKE&CV1Y<~2PKvQqP)V9`jHilfYN(}-{ivsb42?`+B9oZR6s9tb{W*XGna)8R z%pn}gVI0m8%-~3l;%JWHSdQa(PT)jN;$%+YR8He`&frYW;%v_0T+ZWsF5p5g;$kl0 zQZD0iuHZ_p;%ctpTCU@IZs104;%08)R&L{VW^xC2au>6>n|rvI+1$td%;5nZ4rg^2*L_Kj-GQh1(cwt8d#S%x&$xZfids{B7s&!n6tLmw1_1c$L?9oi})sw|JX(c$fEhpAYzu zkNB8R_>|B1oGER$*1T(}SM$qBnh5jn(PP8mvh_)}n+` z%2=EJti!qtU_A!1K7-hR4cUm$wwtgin=zQp8NwC}WlM%JoDqyau{Zk=XI~PGAxSwY#!^8gX~r?0DypfWmOA#Mo(3{BGJ%Oq zVlq>h$~5-p01jk22XQcma43gyI7cvpBRPtrIfi37j^jCj6FG^KIfYX>jng@UGdYX1 zIfrvOkMp^J3%Q7kxr9r(jLW%#E4hlRxrS@Gj_bLB8@Y*_xrJM~joX>Y9o)%X%;IkD z;a+BQANMnd2Y8T&c$i0cl*f3SCwP*lc$#N;mgjh$7kH7Ec$rstmDhNkH+Yk`c$;^4 zm-l#|5BQLe_?S=ll+XB_FZhzL_?mB+%eQ>T_x!+*{KU`v!ms?s@BG1^Y)o#Dm82QRc&ezThFa>_k9r!&(8vTP zGKtAdVJg$up946M=^Vtt9KxX-#^D^n436X|j^-GS84j-r{ZE z;a%S2eLmnrKH_6O;Zr{2bH3n9zT#`XVJ_eD9pCcB}0d zNk7)2gi^{_oBpiBx(r}F2C_bb*nkb$h|s2+uqm4{n9Ui&77S%ehB2Jbh9lXEt=WcA zY|D0R&kpR!Xm(;}c41d`V|VsoPxfMO_94!`Bp5@Ia#D_4&!i+U(tIiH#{VR3vMODceF!~z&hHE9dx!L`{I=iN-1D2C zi(6{}anZ9(NzZ*HCqxhKeI|bB0^(bJ-aGqjZ1!<0=|62czE;ZDYCfJVPkX59lVZx9 zJIL_d>Br*#QCo!iBs@#=k+h-BTdm9Rb!KbzM3p{ROu6b)V<*-}k8Q<15Wn^U^3FX= zRzB~mFCM^pUz!EAZKA$DFpWJf;*+1E5px*wcW%*kkxo6Iegtz4LkH%3hpXi}d>ED$8AN3nQZ5qB%8wTMU z(k`f-CM4?pT23bRy10U4&=2i-?Ay=Il~%qczF?n;jw7D?`lH{Iljh&IZS;U!^mN)Q z|5ZLswQ7!+&p)cyrU%>ftCyth9{N`+b4Pf>_eC)U>oj_k(|tNs2@I-BS@X-52$aq+kD)iAkw%)CbgW6#QKM!VSbu5GL@FS>F6@C?k7UbmJ1 z!nCIY9qB}87GY5qV{w+C3td@~rC6F}SeE7J#`3Jdimb%Stiq~vrw2XhMdqF{ zN3s=LvkjxzmhIS{9oUi4?8MIO!mjMb?(D&y?8V;fL!5m{Foq=Mq!>#Dm82QRc&ezT zhFa>_k9r!&(8vTPGKnykPhl$4*q;M9km(%6!5qS&9LC`s!3>V%D30bBj^#Lx=LAmV zBu?fOPUSRC=M2u|EY9W}&gDGL=K?O|A};0mH5PapYj=>^95h>6)W4m3aj$9 ze}BWf%;j6Y<9mMKM}FdGe&JVs<9E7C--GwP{(ukph>v-Xp0>5~_YXRF9X^AIu3!Ca z!$RH<_v?Dmn?9_@>hxs|)}$Y6Q9>z;N*DdOx4+Mro0j%BnxDgWM@A>>GyO|zpPv7H zZ>Rmx_fy^)K^-_v)Xrg!sh-#P2KN}Zqjy+)e-`Yk#;lSp2fByQ24p@EMZ(H~I_MP-A!nMDX=bTJlZ3A)ggC0UA4x680B%Mtp+@~ps$gmJbqtFS8F=|N9=5!$~GtFbzL zS%Wp{$6Az7N*STR?oIFqwDn{zmq^EjUixR8sum`k{n%eb5?xRR^5 znrpb0>$sj9xRINXyL?e#Xa)Q>aXuV5#tsiBrS z_M@JwxSDHd>H}wZeI`xgsHv|u^^K{vwP!iHF_0Blk(KB{PkPatKCH&-Ok;lz;6OHK z2wO0eEm@Xf4Cf#YW(G%c0w-}Yr*JB#aXM>r4(D<$*Ks{Ja3eQyGq-Rnw{bf&xq~~o zi&@;wJ>1J|?&E&m;7#7*ZQkKs2GQzxneY2{;Txq*Us<_Be-Fo9^q6TSubJ|h={!5E zjq~EvZkvYd>)~FvmG{>)wOI$RJ5ubpX=>vzcII#AmA%*0Z@YWlgPye1?tQ%<`t<hZB65-X}lcdy@NS~LphAY zIfACXc9hpg6Xu7eF&@Tt=!0QgFQ^}$VSD}*1yL@{If|JOK}WB(7((s=mB`wO!aOS24XvKFP3u^yw?mhIS{9oUhb*@a!%josOU zJ=u%B*@rm$l3)x;%1JSnG*vXv$OI-biOEdiK_22^9^p|Q<8hwgNuJ_qp5a-Z<9S}- zMPA}%Ug1^VWiH?H9pCcBDNQPG8m_^re1;{!~I!p9*!@pLJN50j$SB)@KkKupzC@FPqyo zge@4#mJDM!BN)k6Y|S>b)`v&iwi7$E3%jx#yR!%Xv@cgkQ%Ra}jHilfYN(}-{ivsb z42?`+B9oZR6s9tb`RCGuymv5%a43gyI7cvpBRPtrIfi37j^jCj6FG^KIfYX>jng@U zGdYX1IfvHf#EWgagiE=M%ejIpxr(c~hHJTw>$!m&xrv*(gH=XjnMc#)TQnOAs~_xXSi`G}8sk5BlN z&-k1#_>!-9gEx7Lw|R%J`G$9y%eQ>T_x!+*{KU`v!ms?s@APbwy|4C~*RS&j9lY1t z{k5if;*z<$tuo{P=7|>99K+P%a7Hkat=O7v7{#`1$M)>Nj*Mm}c4ilLWjA(b5B6j) z_NJI~UWK?y(u`v~Ra8?$Ep_ZiJq=`NWC9bJ#AK#0m1*qH0UXG54&wjjiT|4?+L<%j su#o-`?!zCddxZO%7j3X(pD<74-`5P+^g}3ge>1E{!gb7lbD#770ZHV@hX4Qo literal 0 HcmV?d00001 diff --git a/build/.ninja_log b/build/.ninja_log new file mode 100644 index 0000000..fb0be1e --- /dev/null +++ b/build/.ninja_log @@ -0,0 +1,16 @@ +# ninja log v7 +1 1875 1779866878396024286 CMakeFiles/saqut.dir/src/parser/nodes/identifier.cpp.o eb96bb4b1eb4ad80 +1 1743 1779866878396133191 CMakeFiles/saqut.dir/src/parser/nodes/literal.cpp.o 78f2c4da7c9b2281 +1 1835 1779866851291850429 CMakeFiles/saqut.dir/src/parser/nodes/binary_expr.cpp.o d2e2bb2f8a63c6d2 +3 1976 1779866851293202930 CMakeFiles/saqut.dir/src/parser/nodes/program.cpp.o ac5bbcd74d87561a +1 1828 1779866851291959426 CMakeFiles/saqut.dir/src/parser/nodes/declarations.cpp.o b6c56f04a257f685 +1 1991 1779866851292085983 CMakeFiles/saqut.dir/src/parser/nodes/expressions.cpp.o 4057e3d63c63a1ab +6 2108 1779866851296202934 CMakeFiles/saqut.dir/src/parser/nodes/statements.cpp.o b5c20724bbf3648c +1 2478 1779866878395241768 CMakeFiles/saqut.dir/src/main.cpp.o 110c26cb1d0c3a23 +2967 3100 1779866359829193015 saqut 78d8bacf305cfc59 +1 1450 1779866851291202927 CMakeFiles/saqut.dir/src/lexer/lexer.cpp.o 90eeec811f2137e6 +0 1481 1779866851290202926 CMakeFiles/saqut.dir/src/core/sourcefile.cpp.o da6f5fc90e87e6b1 +1 1410 1779866878396365249 CMakeFiles/saqut.dir/src/tokenizer/tokenizer.cpp.o a01677f8bb4f4dbc +1 1579 1779866878396233551 CMakeFiles/saqut.dir/src/parser/parser.cpp.o 2c65b7be26cead32 +1 1163 1779866916763301383 CMakeFiles/saqut.dir/src/parser/parser.cpp.o 2c65b7be26cead32 +1163 1283 1779866917925303269 saqut 89052e51305cb697 diff --git a/build/CMakeCache.txt b/build/CMakeCache.txt new file mode 100644 index 0000000..98eaaae --- /dev/null +++ b/build/CMakeCache.txt @@ -0,0 +1,360 @@ +# This is the CMakeCache file. +# For build in directory: /home/saqut/Masaüstü/saqutcompiler/build +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING=Debug + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of build database during the build. +CMAKE_EXPORT_BUILD_DATABASE:BOOL= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= + +//Value Computed by CMake. +CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/home/saqut/Masaüstü/saqutcompiler/build/CMakeFiles/pkgRedirects + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Program used to build from build.ninja files. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/ninja + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_COMPAT_VERSION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=saqut + +//Value Computed by CMake +CMAKE_PROJECT_SPDX_LICENSE:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_VERSION:STATIC=0.1 + +//Value Computed by CMake +CMAKE_PROJECT_VERSION_MAJOR:STATIC=0 + +//Value Computed by CMake +CMAKE_PROJECT_VERSION_MINOR:STATIC=1 + +//Value Computed by CMake +CMAKE_PROJECT_VERSION_PATCH:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_VERSION_TWEAK:STATIC= + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the archiver during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the archiver during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the archiver during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the archiver during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the archiver during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//Path to a program. +CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Value Computed by CMake +saqut_BINARY_DIR:STATIC=/home/saqut/Masaüstü/saqutcompiler/build + +//Value Computed by CMake +saqut_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +saqut_SOURCE_DIR:STATIC=/home/saqut/Masaüstü/saqutcompiler + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/saqut/Masaüstü/saqutcompiler/build +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=4 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=3 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=2 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Path to cache edit program executable. +CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_BUILD_DATABASE +CMAKE_EXPORT_BUILD_DATABASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Ninja +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/saqut/Masaüstü/saqutcompiler +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//Name of CMakeLists files to read +CMAKE_LIST_FILE_NAME:INTERNAL=CMakeLists.txt +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_TAPI +CMAKE_TAPI-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 + diff --git a/build/CMakeFiles/4.3.2/CMakeCXXCompiler.cmake b/build/CMakeFiles/4.3.2/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..3adb7e2 --- /dev/null +++ b/build/CMakeFiles/4.3.2/CMakeCXXCompiler.cmake @@ -0,0 +1,102 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "16.1.1") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "20") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_STANDARD_LATEST "26") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23;cxx_std_26") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") +set(CMAKE_CXX26_COMPILE_FEATURES "cxx_std_26") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_CXX_COMPILER_APPLE_SYSROOT "") +set(CMAKE_CXX_SIMULATE_VERSION "") +set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "x86_64") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_LINKER_LINK "") +set(CMAKE_LINKER_LLD "") +set(CMAKE_CXX_COMPILER_LINKER "/usr/bin/ld") +set(CMAKE_CXX_COMPILER_LINKER_ID "GNU") +set(CMAKE_CXX_COMPILER_LINKER_VERSION 2.46.0) +set(CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT GNU) +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang IN ITEMS C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED TRUE) +set(CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE) +set(CMAKE_CXX_LINKER_PUSHPOP_STATE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/16.1.1;/usr/include/c++/16.1.1/x86_64-pc-linux-gnu;/usr/include/c++/16.1.1/backward;/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include;/usr/local/include;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;atomic_asneeded;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1;/usr/lib;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") +set(CMAKE_CXX_COMPILER_CLANG_RESOURCE_DIR "") + +set(CMAKE_CXX_COMPILER_IMPORT_STD "") +set(CMAKE_CXX_COMPILER_IMPORT_STD_ERROR_MESSAGE "Experimental `import std` support not enabled when detecting toolchain; it must be set before `CXX` is enabled (usually a `project()` call)") +set(CMAKE_CXX_STDLIB_MODULES_JSON "") diff --git a/build/CMakeFiles/4.3.2/CMakeDetermineCompilerABI_CXX.bin b/build/CMakeFiles/4.3.2/CMakeDetermineCompilerABI_CXX.bin new file mode 100755 index 0000000000000000000000000000000000000000..8c9df67f268068d473ba8a39871bd2a48f396e26 GIT binary patch literal 16048 zcmeHOT}&L;6~4O|o76vG2O1ow@eoy(ql7VFOo=Pv zv*X46d8qm@SK2-IeCK@U-Z^t;_s-0{Ka3CdM<|=|f{p`u)o36+ zD1Su_uw;9wJq^iFH2GbUuMm%=pNCypZC3uPUF9+sRk}fvd8i_9op|fSV|j(zW6Al% zoZ#mf%4bl18EjZsqAwPd_!((J?M@k!D4ugwg6&-(UQlY}&yw3a`GJ@IZ`vCn-bD%+ zlsryYa(ko1YovY#We4?>B_H3{fJZ}#Jnk-dSe>BuHaqVcoo|*A3XA=%hYy~sT~Np`d!%A}h!PHuLtd9Jggxuab#baGb4dD0eOE_mtGBadK~I#A7)YEvm- zqSlIdO5p>8iJo4wO+VZ&xZ0*4!2^!UbAvT35zxZ1#TV9_0KI zouTmc&*Q6Zx5C%x`euBE0@lQoopILd0{DWa{2BxJdBRtYDLam3JV#vK^5HZjrRjxK6c=)!lv~FDb_?U6& zW|a|n!?=3etA_wbC_qhdb+UGU-v%H1x6m~PW-)ts%vkLDP=~6q^nth2SnfIic(LIf zfYwsQV)2dYM*)aTT;Av}^dlxFH*}15Z3=wHAjZ;D*Nvsw)i>j}u*=Kw>&6SlxrS@I zgs6ROOI_`+S0eFSgx13$RDXh&*SAD#Uk_S7E3+8O4bMZL6g6_C_BEkm0e-d;z8t?b z0jHyMu1aSIyA_r&17QZj41^g7GZ1DV%s`ldFau!*!VH8N2s7}nGl1{0?p6}R{l||M z;8j|F(oD~I?s!Y*gx`NSalAiy)SEYLH*crM-9(Q$FdR?x4R;IaC;7>F&o=Weyxtoh zOpJ~W#?AO}U!r>$Jfz)9I^(boVS+R_H9ZdRHqDOq2@%;>^;LYQi@jXk zj!-A?ohg>clP5%Et}e1~$F`aa@S+QG3nN-Kk2;g5%0&au>G^!#XRb7 z(c(j1Q#gk=K~QiVBbGI?^L^RN3KrW*Hj->0$zmH-rYSJDyG}SP+LVR)|0t^d04QB= zlio>uxDAy3=FC zR=rhgYia9fX+MlNxpyg;k1gWQ#h?r3HzIZmUN5eZ!@VFY`R@lj3U}WlcvI{vO;AUC zA%Nq(J>opxneqfwBBD`fF@^B?`ntsL6+9l5Rfwmcf^qozVSGvY? z(tnqzYf|z3-P2u|O-uZXVvW`XGwTO{*Fpa||BT-RTmxLh z7*X+J?ME@iiK6{Osp_83#snU>tr3IJO%+-Wz~p9)ibP6-B&J9E@$WiM1NSgK_Es z*UDX`*0KqHY!h6ZOu1gGo`;3=@D$GUtSJFN5|-iTP6E2IBH#3~W(wEj7r-^0H>WcB zq?Iw#UfwO3*6f@}<+C#x+q2VpOJxsSmG79A>ss)%Fz31RV$!v;wwa#IX6J$8(@gO6 z%3OPgtnb>rr%v@kD^A9CyL%FPYGy{5-yCf1aB`D*)Ax`P(Kdx{JbE;f&J?tpb}ZN> z0QScu%V*Cxo|mzGE}hZ?(t`fV-GXP6m>`IQ=`qdz6Wv4daVG9zfJdKWX51jq=sO|I zzSG0qLy2Bt4h$ae=^iwX_xGQSkD8<1J@6D%n0DIoEZE?19QH7zot!yau+tF7zlR~_ z--keZ9MXlnIc??AxH$r|3Y5S`h!P7nGRSO#3v8;u2d}cH*sj_)0iDQUo5@0ffxGR+ zsIYCL;?@kI7v{5`l?3UzN=|bvm-lRaDmSYqXC2th;-rP{Ib*v8C!Z@*Ot86j#zF$daXg`W_8ff6%;;`j=2*9rICdZU*U57k0G2- z;T#4oXIVDe=S61t4=69NybS(FHu#(EyJHsm`b!5WH(*Y~?ejd1CC}%$U7lZYj2KjK zj>deR$FaOXjyPY!wwcfKF#|B1`Z1s9g)Dg<2rjY&`#%CG&e@pH^E8$`zvce3A4`0x zfpb9Cc^=5JMKvp*|NHw-u*g6KV>6%Up)A+Qk=qX*{~54jT%HG){&(sWk>}eK=8p6K z{QzGh9?NF~2_rLy6F&;@`Tvt8-w!Z>kAwARh|k9_G_sJqNGc10Srr$chFxU-MRH)t z2HRtu<)46C>*Mphd5!j~vLCp}!aB=qfa2KY_Iduu z`(1foE8j0MkH_I(fE)4gd4Jo=ApoHqRHF3Fe3pL$i=WT))HUMs?+gcE9!n(q`65Q1 zElO&nvMBKg*a~FC`1rM$GHApP`eR%EvYpx|_mYYE!Rw#-e#zHPi42t(1ze$yVH}vH o-tqg3_ix;HsBRRz@q%(X5S-gpR-DsU=AXtt7AW-rLO>P&1TbSgRR910 literal 0 HcmV?d00001 diff --git a/build/CMakeFiles/4.3.2/CMakeSystem.cmake b/build/CMakeFiles/4.3.2/CMakeSystem.cmake new file mode 100644 index 0000000..0594f3b --- /dev/null +++ b/build/CMakeFiles/4.3.2/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-7.0.9-1-MANJARO") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "7.0.9-1-MANJARO") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-7.0.9-1-MANJARO") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "7.0.9-1-MANJARO") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/build/CMakeFiles/4.3.2/CompilerIdCXX/CMakeCXXCompilerId.cpp b/build/CMakeFiles/4.3.2/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..b35f567 --- /dev/null +++ b/build/CMakeFiles/4.3.2/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,949 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__RENESAS__) +# define COMPILER_ID "Renesas" +/* __RENESAS_VERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__RENESAS_VERSION__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR HEX(__RENESAS_VERSION__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__RENESAS_VERSION__ >> 8 & 0xFF) + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) && defined(__ti__) +# define COMPILER_ID "TIClang" + # define COMPILER_VERSION_MAJOR DEC(__ti_major__) + # define COMPILER_VERSION_MINOR DEC(__ti_minor__) + # define COMPILER_VERSION_PATCH DEC(__ti_patchlevel__) +# define COMPILER_VERSION_INTERNAL DEC(__ti_version__) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__DCC__) && defined(_DIAB_TOOL) +# define COMPILER_ID "Diab" + # define COMPILER_VERSION_MAJOR DEC(__VERSION_MAJOR_NUMBER__) + # define COMPILER_VERSION_MINOR DEC(__VERSION_MINOR_NUMBER__) + # define COMPILER_VERSION_PATCH DEC(__VERSION_ARCH_FEATURE_NUMBER__) + # define COMPILER_VERSION_TWEAK DEC(__VERSION_BUG_FIX_NUMBER__) + + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__clang__) && defined(__ti__) +# if defined(__ARM_ARCH) +# define ARCHITECTURE_ID "ARM" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) || defined(__CPARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__RENESAS__) +# if defined(__CCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__CCRL__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__CCRH__) +# define ARCHITECTURE_ID "RH850" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#define CXX_STD_98 199711L +#define CXX_STD_11 201103L +#define CXX_STD_14 201402L +#define CXX_STD_17 201703L +#define CXX_STD_20 202002L +#define CXX_STD_23 202302L + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) +# if _MSVC_LANG > CXX_STD_17 +# define CXX_STD _MSVC_LANG +# elif _MSVC_LANG == CXX_STD_17 && defined(__cpp_aggregate_paren_init) +# define CXX_STD CXX_STD_20 +# elif _MSVC_LANG > CXX_STD_14 && __cplusplus > CXX_STD_17 +# define CXX_STD CXX_STD_20 +# elif _MSVC_LANG > CXX_STD_14 +# define CXX_STD CXX_STD_17 +# elif defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi) +# define CXX_STD CXX_STD_14 +# elif defined(__INTEL_CXX11_MODE__) +# define CXX_STD CXX_STD_11 +# else +# define CXX_STD CXX_STD_98 +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# if _MSVC_LANG > __cplusplus +# define CXX_STD _MSVC_LANG +# else +# define CXX_STD __cplusplus +# endif +#elif defined(__NVCOMPILER) +# if __cplusplus == CXX_STD_17 && defined(__cpp_aggregate_paren_init) +# define CXX_STD CXX_STD_20 +# else +# define CXX_STD __cplusplus +# endif +#elif defined(__INTEL_COMPILER) || defined(__PGI) +# if __cplusplus == CXX_STD_11 && defined(__cpp_namespace_attributes) +# define CXX_STD CXX_STD_17 +# elif __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi) +# define CXX_STD CXX_STD_14 +# else +# define CXX_STD __cplusplus +# endif +#elif (defined(__IBMCPP__) || defined(__ibmxl__)) && defined(__linux__) +# if __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi) +# define CXX_STD CXX_STD_14 +# else +# define CXX_STD __cplusplus +# endif +#elif __cplusplus == 1 && defined(__GXX_EXPERIMENTAL_CXX0X__) +# define CXX_STD CXX_STD_11 +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_standard_default = "INFO" ":" "standard_default[" +#if CXX_STD > CXX_STD_23 + "26" +#elif CXX_STD > CXX_STD_20 + "23" +#elif CXX_STD > CXX_STD_17 + "20" +#elif CXX_STD > CXX_STD_14 + "17" +#elif CXX_STD > CXX_STD_11 + "14" +#elif CXX_STD >= CXX_STD_11 + "11" +#else + "98" +#endif +"]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__) || defined(__RENESAS__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#if defined(COMPILER_VERSION_INTERNAL) || defined(COMPILER_VERSION_INTERNAL_STR) + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} diff --git a/build/CMakeFiles/CMakeConfigureLog.yaml b/build/CMakeFiles/CMakeConfigureLog.yaml new file mode 100644 index 0000000..44ef88f --- /dev/null +++ b/build/CMakeFiles/CMakeConfigureLog.yaml @@ -0,0 +1,1189 @@ + +--- +events: + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineSystem.cmake:12 (find_program)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_UNAME" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: true + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "uname" + candidate_directories: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/usr/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + searched_directories: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/uname" + - "/home/saqut/.local/bin/uname" + - "/usr/local/bin/uname" + found: "/usr/bin/uname" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineSystem.cmake:212 (message)" + - "CMakeLists.txt:2 (project)" + message: | + The system is: Linux - 7.0.9-1-MANJARO - x86_64 + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeNinjaFindMake.cmake:5 (find_program)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_MAKE_PROGRAM" + description: "Program used to build from build.ninja files." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: true + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "ninja-build" + - "ninja" + - "samu" + candidate_directories: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/usr/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + searched_directories: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/ninja-build" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/ninja" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/samu" + - "/home/saqut/.local/bin/ninja-build" + - "/home/saqut/.local/bin/ninja" + - "/home/saqut/.local/bin/samu" + - "/usr/local/bin/ninja-build" + - "/usr/local/bin/ninja" + - "/usr/local/bin/samu" + - "/usr/bin/ninja-build" + found: "/usr/bin/ninja" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompiler.cmake:73 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:69 (_cmake_find_compiler)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_CXX_COMPILER" + description: "CXX compiler" + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: true + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "c++" + - "CC" + - "g++" + - "aCC" + - "cl" + - "bcc" + - "xlC" + - "icpx" + - "icx" + - "clang++" + candidate_directories: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/usr/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + searched_directories: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/c++" + - "/home/saqut/.local/bin/c++" + - "/usr/local/bin/c++" + found: "/usr/bin/c++" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:468 (find_file)" + - "/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:506 (CMAKE_DETERMINE_COMPILER_ID_WRITE)" + - "/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD)" + - "/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:125 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:2 (project)" + mode: "file" + variable: "src_in" + description: "Path to a file." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: true + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "CMakeCXXCompilerId.cpp.in" + candidate_directories: + - "/usr/share/cmake/Modules/" + found: "/usr/share/cmake/Modules/CMakeCXXCompilerId.cpp.in" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:17 (message)" + - "/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:125 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:2 (project)" + message: | + Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. + Compiler: /usr/bin/c++ + Build flags: + Id flags: + + The output was: + 0 + + + Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + + The CXX compiler identification is GNU, found in: + /home/saqut/Masaüstü/saqutcompiler/build/CMakeFiles/4.3.2/CompilerIdCXX/a.out + + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_AR" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "ar" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + found: "/usr/bin/ar" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_RANLIB" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "ranlib" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + found: "/usr/bin/ranlib" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_STRIP" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "strip" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + found: "/usr/bin/strip" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_LINKER" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "ld" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + found: "/usr/bin/ld" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_NM" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "nm" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + found: "/usr/bin/nm" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_OBJDUMP" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "objdump" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + found: "/usr/bin/objdump" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_OBJCOPY" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "objcopy" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + found: "/usr/bin/objcopy" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_READELF" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "readelf" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + found: "/usr/bin/readelf" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_DLLTOOL" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "dlltool" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + searched_directories: + - "/usr/bin/dlltool" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/dlltool" + - "/home/saqut/.local/bin/dlltool" + - "/usr/local/bin/dlltool" + - "/bin/dlltool" + - "/usr/local/sbin/dlltool" + - "/opt/cuda/bin/dlltool" + - "/var/lib/flatpak/exports/bin/dlltool" + - "/usr/lib/jvm/default/bin/dlltool" + - "/usr/bin/site_perl/dlltool" + - "/usr/bin/vendor_perl/dlltool" + - "/usr/bin/core_perl/dlltool" + found: false + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_ADDR2LINE" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "addr2line" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + found: "/usr/bin/addr2line" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeFindBinUtils.cmake:243 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:206 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_TAPI" + description: "Path to a program." + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "tapi" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + searched_directories: + - "/usr/bin/tapi" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/tapi" + - "/home/saqut/.local/bin/tapi" + - "/usr/local/bin/tapi" + - "/bin/tapi" + - "/usr/local/sbin/tapi" + - "/opt/cuda/bin/tapi" + - "/var/lib/flatpak/exports/bin/tapi" + - "/usr/lib/jvm/default/bin/tapi" + - "/usr/bin/site_perl/tapi" + - "/usr/bin/vendor_perl/tapi" + - "/usr/bin/core_perl/tapi" + found: false + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/Compiler/GNU-FindBinUtils.cmake:18 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:207 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_CXX_COMPILER_AR" + description: "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "gcc-ar-16.1" + - "gcc-ar-16" + - "gcc-ar16" + - "gcc-ar" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + searched_directories: + - "/usr/bin/gcc-ar-16.1" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/gcc-ar-16.1" + - "/home/saqut/.local/bin/gcc-ar-16.1" + - "/usr/local/bin/gcc-ar-16.1" + - "/bin/gcc-ar-16.1" + - "/usr/local/sbin/gcc-ar-16.1" + - "/opt/cuda/bin/gcc-ar-16.1" + - "/var/lib/flatpak/exports/bin/gcc-ar-16.1" + - "/usr/lib/jvm/default/bin/gcc-ar-16.1" + - "/usr/bin/site_perl/gcc-ar-16.1" + - "/usr/bin/vendor_perl/gcc-ar-16.1" + - "/usr/bin/core_perl/gcc-ar-16.1" + - "/usr/bin/gcc-ar-16" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/gcc-ar-16" + - "/home/saqut/.local/bin/gcc-ar-16" + - "/usr/local/bin/gcc-ar-16" + - "/bin/gcc-ar-16" + - "/usr/local/sbin/gcc-ar-16" + - "/opt/cuda/bin/gcc-ar-16" + - "/var/lib/flatpak/exports/bin/gcc-ar-16" + - "/usr/lib/jvm/default/bin/gcc-ar-16" + - "/usr/bin/site_perl/gcc-ar-16" + - "/usr/bin/vendor_perl/gcc-ar-16" + - "/usr/bin/core_perl/gcc-ar-16" + - "/usr/bin/gcc-ar16" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/gcc-ar16" + - "/home/saqut/.local/bin/gcc-ar16" + - "/usr/local/bin/gcc-ar16" + - "/bin/gcc-ar16" + - "/usr/local/sbin/gcc-ar16" + - "/opt/cuda/bin/gcc-ar16" + - "/var/lib/flatpak/exports/bin/gcc-ar16" + - "/usr/lib/jvm/default/bin/gcc-ar16" + - "/usr/bin/site_perl/gcc-ar16" + - "/usr/bin/vendor_perl/gcc-ar16" + - "/usr/bin/core_perl/gcc-ar16" + found: "/usr/bin/gcc-ar" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "find-v1" + backtrace: + - "/usr/share/cmake/Modules/Compiler/GNU-FindBinUtils.cmake:30 (find_program)" + - "/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:207 (include)" + - "CMakeLists.txt:2 (project)" + mode: "program" + variable: "CMAKE_CXX_COMPILER_RANLIB" + description: "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" + settings: + SearchFramework: "NEVER" + SearchAppBundle: "NEVER" + CMAKE_FIND_USE_CMAKE_PATH: false + CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: false + CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true + CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true + CMAKE_FIND_USE_INSTALL_PREFIX: true + names: + - "gcc-ranlib-16.1" + - "gcc-ranlib-16" + - "gcc-ranlib16" + - "gcc-ranlib" + candidate_directories: + - "/usr/bin/" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/" + - "/home/saqut/.local/bin/" + - "/usr/local/bin/" + - "/bin/" + - "/usr/local/sbin/" + - "/opt/cuda/bin/" + - "/var/lib/flatpak/exports/bin/" + - "/usr/lib/jvm/default/bin/" + - "/usr/bin/site_perl/" + - "/usr/bin/vendor_perl/" + - "/usr/bin/core_perl/" + searched_directories: + - "/usr/bin/gcc-ranlib-16.1" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/gcc-ranlib-16.1" + - "/home/saqut/.local/bin/gcc-ranlib-16.1" + - "/usr/local/bin/gcc-ranlib-16.1" + - "/bin/gcc-ranlib-16.1" + - "/usr/local/sbin/gcc-ranlib-16.1" + - "/opt/cuda/bin/gcc-ranlib-16.1" + - "/var/lib/flatpak/exports/bin/gcc-ranlib-16.1" + - "/usr/lib/jvm/default/bin/gcc-ranlib-16.1" + - "/usr/bin/site_perl/gcc-ranlib-16.1" + - "/usr/bin/vendor_perl/gcc-ranlib-16.1" + - "/usr/bin/core_perl/gcc-ranlib-16.1" + - "/usr/bin/gcc-ranlib-16" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/gcc-ranlib-16" + - "/home/saqut/.local/bin/gcc-ranlib-16" + - "/usr/local/bin/gcc-ranlib-16" + - "/bin/gcc-ranlib-16" + - "/usr/local/sbin/gcc-ranlib-16" + - "/opt/cuda/bin/gcc-ranlib-16" + - "/var/lib/flatpak/exports/bin/gcc-ranlib-16" + - "/usr/lib/jvm/default/bin/gcc-ranlib-16" + - "/usr/bin/site_perl/gcc-ranlib-16" + - "/usr/bin/vendor_perl/gcc-ranlib-16" + - "/usr/bin/core_perl/gcc-ranlib-16" + - "/usr/bin/gcc-ranlib16" + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin/gcc-ranlib16" + - "/home/saqut/.local/bin/gcc-ranlib16" + - "/usr/local/bin/gcc-ranlib16" + - "/bin/gcc-ranlib16" + - "/usr/local/sbin/gcc-ranlib16" + - "/opt/cuda/bin/gcc-ranlib16" + - "/var/lib/flatpak/exports/bin/gcc-ranlib16" + - "/usr/lib/jvm/default/bin/gcc-ranlib16" + - "/usr/bin/site_perl/gcc-ranlib16" + - "/usr/bin/vendor_perl/gcc-ranlib16" + - "/usr/bin/core_perl/gcc-ranlib16" + found: "/usr/bin/gcc-ranlib" + search_context: + ENV{PATH}: + - "/home/saqut/.vscode/extensions/vadimcn.vscode-lldb-1.12.0/bin" + - "/home/saqut/.local/bin" + - "/usr/local/bin" + - "/usr/bin" + - "/bin" + - "/usr/local/sbin" + - "/opt/cuda/bin" + - "/var/lib/flatpak/exports/bin" + - "/usr/lib/jvm/default/bin" + - "/usr/bin/site_perl" + - "/usr/bin/vendor_perl" + - "/usr/bin/core_perl" + - + kind: "try_compile-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:83 (try_compile)" + - "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + checks: + - "Detecting CXX compiler ABI info" + directories: + source: "/home/saqut/Masa\u00fcst\u00fc/saqutcompiler/build/CMakeFiles/CMakeScratch/TryCompile-lntpv4" + binary: "/home/saqut/Masa\u00fcst\u00fc/saqutcompiler/build/CMakeFiles/CMakeScratch/TryCompile-lntpv4" + cmakeVariables: + CMAKE_CXX_FLAGS: "" + CMAKE_CXX_FLAGS_DEBUG: "-g" + CMAKE_CXX_SCAN_FOR_MODULES: "OFF" + CMAKE_CXX_STDLIB_MODULES_JSON: "" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_CXX_ABI_COMPILED" + cached: true + stdout: | + Change Dir: '/home/saqut/Masaüstü/saqutcompiler/build/CMakeFiles/CMakeScratch/TryCompile-lntpv4' + + Run Build Command(s): /usr/bin/ninja -v cmTC_ff321 + [1/2] /usr/bin/c++ -v -o CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp + Using built-in specs. + COLLECT_GCC=/usr/bin/c++ + Target: x86_64-pc-linux-gnu + Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --disable-fixincludes + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 16.1.1 20260430 (GCC) + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_ff321.dir/' + /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/cc1plus -quiet -v -D_GNU_SOURCE /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_ff321.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -o /tmp/ccSiM3Hl.s + GNU C++20 (GCC) version 16.1.1 20260430 (x86_64-pc-linux-gnu) + compiled by GNU C version 16.1.1 20260430, GMP version 6.3.0, MPFR version 4.2.2, MPC version 1.4.1, isl version isl-0.27-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include-fixed" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../x86_64-pc-linux-gnu/include" + #include "..." search starts here: + #include <...> search starts here: + /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1 + /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1/x86_64-pc-linux-gnu + /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1/backward + /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include + /usr/local/include + /usr/include + End of search list. + Compiler executable checksum: d47d0c990a24bc0dbaf3bd00656bd5f3 + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_ff321.dir/' + as -v --64 -o CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccSiM3Hl.s + GNU assembler version 2.46.0 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.46.0 + COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.' + [2/2] : && /usr/bin/c++ -v -Wl,-v CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_ff321 && : + Using built-in specs. + COLLECT_GCC=/usr/bin/c++ + COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/lto-wrapper + Target: x86_64-pc-linux-gnu + Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --disable-fixincludes + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 16.1.1 20260430 (GCC) + COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_ff321' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_ff321.' + /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/collect2 -plugin /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccgqnPZN.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-latomic_asneeded -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o cmTC_ff321 /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../.. -L/lib -L/usr/lib -v CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -latomic_asneeded -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crtn.o + collect2 version 16.1.1 20260430 + /usr/bin/ld -plugin /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccgqnPZN.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-latomic_asneeded -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o cmTC_ff321 /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../.. -L/lib -L/usr/lib -v CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -latomic_asneeded -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crtn.o + GNU ld (GNU Binutils) 2.46.0 + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_ff321' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_ff321.' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:217 (message)" + - "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + message: | + Parsed CXX implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1] + add: [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1/x86_64-pc-linux-gnu] + add: [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1/backward] + add: [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include] + add: [/usr/local/include] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1] ==> [/usr/include/c++/16.1.1] + collapse include dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1/x86_64-pc-linux-gnu] ==> [/usr/include/c++/16.1.1/x86_64-pc-linux-gnu] + collapse include dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1/backward] ==> [/usr/include/c++/16.1.1/backward] + collapse include dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include] ==> [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/16.1.1;/usr/include/c++/16.1.1/x86_64-pc-linux-gnu;/usr/include/c++/16.1.1/backward;/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include;/usr/local/include;/usr/include] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:253 (message)" + - "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + message: | + Parsed CXX implicit link information: + link line regex: [^( *|.*[/\\])(ld[0-9]*(|\\.[a-rt-z][a-z]*|\\.s[a-np-z][a-z]*|\\.so[a-z]+)|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + linker tool regex: [^[ ]*(->|"|[0-9]+>[ -]*Build:[ 0-9]+ ms[ ]*)?[ ]*(([^"]*[/\\])?(ld[0-9]*(|\\.[a-rt-z][a-z]*|\\.s[a-np-z][a-z]*|\\.so[a-z]+)))("|,| |$)] + ignore line: [Change Dir: '/home/saqut/Masaüstü/saqutcompiler/build/CMakeFiles/CMakeScratch/TryCompile-lntpv4'] + ignore line: [] + ignore line: [Run Build Command(s): /usr/bin/ninja -v cmTC_ff321] + ignore line: [[1/2] /usr/bin/c++ -v -o CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [Target: x86_64-pc-linux-gnu] + ignore line: [Configured with: /build/gcc/src/gcc/configure --enable-languages=ada c c++ d fortran go lto m2 objc obj-c++ rust cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --disable-fixincludes] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 16.1.1 20260430 (GCC) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_ff321.dir/'] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/cc1plus -quiet -v -D_GNU_SOURCE /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_ff321.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -o /tmp/ccSiM3Hl.s] + ignore line: [GNU C++20 (GCC) version 16.1.1 20260430 (x86_64-pc-linux-gnu)] + ignore line: [ compiled by GNU C version 16.1.1 20260430 GMP version 6.3.0 MPFR version 4.2.2 MPC version 1.4.1 isl version isl-0.27-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../x86_64-pc-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1/x86_64-pc-linux-gnu] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../include/c++/16.1.1/backward] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [Compiler executable checksum: d47d0c990a24bc0dbaf3bd00656bd5f3] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_ff321.dir/'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccSiM3Hl.s] + ignore line: [GNU assembler version 2.46.0 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.46.0] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.'] + ignore line: [[2/2] : && /usr/bin/c++ -v -Wl -v CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_ff321 && :] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/lto-wrapper] + ignore line: [Target: x86_64-pc-linux-gnu] + ignore line: [Configured with: /build/gcc/src/gcc/configure --enable-languages=ada c c++ d fortran go lto m2 objc obj-c++ rust cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --disable-fixincludes] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 16.1.1 20260430 (GCC) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_ff321' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_ff321.'] + link line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/collect2 -plugin /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccgqnPZN.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-latomic_asneeded -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o cmTC_ff321 /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../.. -L/lib -L/usr/lib -v CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -latomic_asneeded -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crtn.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccgqnPZN.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-latomic_asneeded] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-o] ==> ignore + arg [cmTC_ff321] ==> ignore + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/Scrt1.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crti.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crti.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../..] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../..] + arg [-L/lib] ==> dir [/lib] + arg [-L/usr/lib] ==> dir [/usr/lib] + arg [-v] ==> ignore + arg [CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-latomic_asneeded] ==> lib [atomic_asneeded] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtendS.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crtn.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crtn.o] + ignore line: [collect2 version 16.1.1 20260430] + ignore line: [/usr/bin/ld -plugin /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccgqnPZN.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-latomic_asneeded -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o cmTC_ff321 /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../.. -L/lib -L/usr/lib -v CMakeFiles/cmTC_ff321.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -latomic_asneeded -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crtn.o] + linker tool for 'CXX': /usr/bin/ld + collapse obj [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/Scrt1.o] ==> [/usr/lib/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crti.o] ==> [/usr/lib/crti.o] + collapse obj [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib/crtn.o] ==> [/usr/lib/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1] ==> [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/../../..] ==> [/usr/lib] + collapse library dir [/lib] ==> [/lib] + collapse library dir [/usr/lib] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;atomic_asneeded;c;gcc_s;gcc] + implicit objs: [/usr/lib/Scrt1.o;/usr/lib/crti.o;/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtbeginS.o;/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/crtendS.o;/usr/lib/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1;/usr/lib;/lib] + implicit fwks: [] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/Internal/CMakeDetermineLinkerId.cmake:38 (message)" + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:299 (cmake_determine_linker_id)" + - "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + message: | + Running the CXX compiler's linker: "/usr/bin/ld" "-v" + GNU ld (GNU Binutils) 2.46.0 +... diff --git a/build/CMakeFiles/InstallScripts.json b/build/CMakeFiles/InstallScripts.json new file mode 100644 index 0000000..e713609 --- /dev/null +++ b/build/CMakeFiles/InstallScripts.json @@ -0,0 +1,7 @@ +{ + "InstallScripts" : + [ + "/home/saqut/Masa\u00fcst\u00fc/saqutcompiler/build/cmake_install.cmake" + ], + "Parallel" : false +} diff --git a/build/CMakeFiles/TargetDirectories.txt b/build/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000..014db8d --- /dev/null +++ b/build/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,3 @@ +/home/saqut/Masaüstü/saqutcompiler/build/CMakeFiles/saqut.dir +/home/saqut/Masaüstü/saqutcompiler/build/CMakeFiles/edit_cache.dir +/home/saqut/Masaüstü/saqutcompiler/build/CMakeFiles/rebuild_cache.dir diff --git a/build/CMakeFiles/cmake.check_cache b/build/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/build/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/build/CMakeFiles/rules.ninja b/build/CMakeFiles/rules.ninja new file mode 100644 index 0000000..bae535b --- /dev/null +++ b/build/CMakeFiles/rules.ninja @@ -0,0 +1,96 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Ninja" Generator, CMake Version 4.3 + +# This file contains all the rules used to get the outputs files +# built from the input files. +# It is included in the main 'build.ninja'. + +# ============================================================================= +# Project: saqut +# Configurations: Debug +# ============================================================================= +# ============================================================================= + +############################################# +# Rule for generating CXX dependencies. + +rule CXX_SCAN__saqut_Debug + depfile = $DEP_FILE + command = /usr/bin/c++ $DEFINES $INCLUDES $FLAGS -E -x c++ $in -MT $DYNDEP_INTERMEDIATE_FILE -MD -MF $DEP_FILE -fmodules-ts -fdeps-file=$DYNDEP_INTERMEDIATE_FILE -fdeps-target=$OBJ_FILE -fdeps-format=p1689r5 -o $PREPROCESSED_OUTPUT_FILE + description = Scanning $in for CXX dependencies + + +############################################# +# Rule to generate ninja dyndep files for CXX. + +rule CXX_DYNDEP__saqut_Debug + command = /usr/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/saqut.dir/CXXDependInfo.json --lang=CXX --modmapfmt=gcc --dd=$out @$out.rsp + description = Generating CXX dyndep file $out + rspfile = $out.rsp + rspfile_content = $in + restat = 1 + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__saqut_scanned_Debug + depfile = $DEP_FILE + deps = gcc + command = ${LAUNCHER}${CODE_CHECK}/usr/bin/c++ $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -fmodules-ts -fmodule-mapper=$DYNDEP_MODULE_MAP_FILE -MD -fdeps-format=p1689r5 -x c++ -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__saqut_unscanned_Debug + depfile = $DEP_FILE + deps = gcc + command = ${LAUNCHER}${CODE_CHECK}/usr/bin/c++ $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX executable. + +rule CXX_EXECUTABLE_LINKER__saqut_Debug + depfile = $DEP_FILE + deps = gcc + command = $PRE_LINK && /usr/bin/c++ $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX executable $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for running custom commands. + +rule CUSTOM_COMMAND + command = $COMMAND + description = $DESC + + +############################################# +# Rule for re-running cmake. + +rule RERUN_CMAKE + command = /usr/bin/cmake --regenerate-during-build -S/home/saqut/Masaüstü/saqutcompiler -B/home/saqut/Masaüstü/saqutcompiler/build + description = Re-running CMake... + generator = 1 + + +############################################# +# Rule for cleaning all built files. + +rule CLEAN + command = /usr/bin/ninja $FILE_ARG -t clean $TARGETS + description = Cleaning all built files... + + +############################################# +# Rule for printing all primary targets available. + +rule HELP + command = /usr/bin/ninja -t targets + description = All primary targets available: + diff --git a/build/build.ninja b/build/build.ninja new file mode 100644 index 0000000..e1adc35 --- /dev/null +++ b/build/build.ninja @@ -0,0 +1,249 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Ninja" Generator, CMake Version 4.3 + +# This file contains all the build statements describing the +# compilation DAG. + +# ============================================================================= +# Write statements declared in CMakeLists.txt: +# +# Which is the root file. +# ============================================================================= + +# ============================================================================= +# Project: saqut +# Configurations: Debug +# ============================================================================= + +############################################# +# Minimal version of Ninja required by this file + +ninja_required_version = 1.5 + + +############################################# +# Set configuration variable for custom commands. + +CONFIGURATION = Debug +# ============================================================================= +# Include auxiliary files. + + +############################################# +# Include rules file. + +include CMakeFiles/rules.ninja + +# ============================================================================= + +############################################# +# Logical path to working directory; prefix for absolute paths. + +cmake_ninja_workdir = /home/saqut/Masaüstü/saqutcompiler/build/ +# ============================================================================= +# Object build statements for EXECUTABLE target saqut + + +############################################# +# Order-only phony target for saqut + +build cmake_object_order_depends_target_saqut: phony || . + +build CMakeFiles/saqut.dir/src/core/sourcefile.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/core/sourcefile.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/core/sourcefile.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/core + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/lexer/lexer.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/lexer/lexer.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/lexer/lexer.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/lexer + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/main.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/main.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/main.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/parser/nodes/binary_expr.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/parser/nodes/binary_expr.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/parser/nodes/binary_expr.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/parser/nodes + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/parser/nodes/declarations.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/parser/nodes/declarations.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/parser/nodes/declarations.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/parser/nodes + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/parser/nodes/expressions.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/parser/nodes/expressions.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/parser/nodes/expressions.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/parser/nodes + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/parser/nodes/identifier.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/parser/nodes/identifier.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/parser/nodes/identifier.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/parser/nodes + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/parser/nodes/literal.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/parser/nodes/literal.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/parser/nodes/literal.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/parser/nodes + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/parser/nodes/program.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/parser/nodes/program.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/parser/nodes/program.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/parser/nodes + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/parser/nodes/statements.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/parser/nodes/statements.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/parser/nodes/statements.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/parser/nodes + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/parser/parser.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/parser/parser.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/parser/parser.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/parser + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + +build CMakeFiles/saqut.dir/src/tokenizer/tokenizer.cpp.o: CXX_COMPILER__saqut_unscanned_Debug /home/saqut/Masaüstü/saqutcompiler/src/tokenizer/tokenizer.cpp || cmake_object_order_depends_target_saqut + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/src/tokenizer/tokenizer.cpp.o.d + FLAGS = -g -std=gnu++20 -Wall -Wextra -g -O0 + INCLUDES = -I/home/saqut/Masaüstü/saqutcompiler/src + OBJECT_DIR = CMakeFiles/saqut.dir + OBJECT_FILE_DIR = CMakeFiles/saqut.dir/src/tokenizer + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + + +# ============================================================================= +# Link build statements for EXECUTABLE target saqut + + +############################################# +# Link the executable saqut + +build saqut: CXX_EXECUTABLE_LINKER__saqut_Debug CMakeFiles/saqut.dir/src/core/sourcefile.cpp.o CMakeFiles/saqut.dir/src/lexer/lexer.cpp.o CMakeFiles/saqut.dir/src/main.cpp.o CMakeFiles/saqut.dir/src/parser/nodes/binary_expr.cpp.o CMakeFiles/saqut.dir/src/parser/nodes/declarations.cpp.o CMakeFiles/saqut.dir/src/parser/nodes/expressions.cpp.o CMakeFiles/saqut.dir/src/parser/nodes/identifier.cpp.o CMakeFiles/saqut.dir/src/parser/nodes/literal.cpp.o CMakeFiles/saqut.dir/src/parser/nodes/program.cpp.o CMakeFiles/saqut.dir/src/parser/nodes/statements.cpp.o CMakeFiles/saqut.dir/src/parser/parser.cpp.o CMakeFiles/saqut.dir/src/tokenizer/tokenizer.cpp.o + CONFIG = Debug + DEP_FILE = CMakeFiles/saqut.dir/link.d + FLAGS = -g + LINK_FLAGS = -Wl,--dependency-file=CMakeFiles/saqut.dir/link.d + OBJECT_DIR = CMakeFiles/saqut.dir + POST_BUILD = : + PRE_LINK = : + TARGET_FILE = saqut + TARGET_PDB = saqut.dbg + TARGET_SUPPORT_DIR = CMakeFiles/saqut.dir + + +############################################# +# Utility command for edit_cache + +build CMakeFiles/edit_cache.util: CUSTOM_COMMAND + COMMAND = cd /home/saqut/Masaüstü/saqutcompiler/build && /usr/bin/ccmake -S/home/saqut/Masaüstü/saqutcompiler -B/home/saqut/Masaüstü/saqutcompiler/build + DESC = Running CMake cache editor... + pool = console + restat = 1 + +build edit_cache: phony CMakeFiles/edit_cache.util + + +############################################# +# Utility command for rebuild_cache + +build CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND + COMMAND = cd /home/saqut/Masaüstü/saqutcompiler/build && /usr/bin/cmake --regenerate-during-build -S/home/saqut/Masaüstü/saqutcompiler -B/home/saqut/Masaüstü/saqutcompiler/build + DESC = Running CMake to regenerate build system... + pool = console + restat = 1 + +build rebuild_cache: phony CMakeFiles/rebuild_cache.util + +# ============================================================================= +# Target aliases. + +# ============================================================================= +# Folder targets. + +# ============================================================================= + +############################################# +# Folder: /home/saqut/Masaüstü/saqutcompiler/build + +build all: phony saqut + +# ============================================================================= +# Built-in targets + + +############################################# +# Re-run CMake if any of its inputs changed. + +build build.ninja /home/saqut/Masaüstü/saqutcompiler/build/cmake_install.cmake: RERUN_CMAKE | /home/saqut/Masaüstü/saqutcompiler/CMakeLists.txt /usr/share/cmake/Modules/CMakeCXXInformation.cmake /usr/share/cmake/Modules/CMakeCommonLanguageInclude.cmake /usr/share/cmake/Modules/CMakeGenericSystem.cmake /usr/share/cmake/Modules/CMakeInitializeConfigs.cmake /usr/share/cmake/Modules/CMakeLanguageInformation.cmake /usr/share/cmake/Modules/CMakeSystemSpecificInformation.cmake /usr/share/cmake/Modules/CMakeSystemSpecificInitialize.cmake /usr/share/cmake/Modules/Compiler/CMakeCommonCompilerMacros.cmake /usr/share/cmake/Modules/Compiler/GNU-CXX.cmake /usr/share/cmake/Modules/Compiler/GNU.cmake /usr/share/cmake/Modules/Internal/CMakeCXXLinkerInformation.cmake /usr/share/cmake/Modules/Internal/CMakeCommonLinkerInformation.cmake /usr/share/cmake/Modules/Linker/GNU-CXX.cmake /usr/share/cmake/Modules/Linker/GNU.cmake /usr/share/cmake/Modules/Platform/Linker/GNU.cmake /usr/share/cmake/Modules/Platform/Linker/Linux-GNU-CXX.cmake /usr/share/cmake/Modules/Platform/Linker/Linux-GNU.cmake /usr/share/cmake/Modules/Platform/Linux-GNU-CXX.cmake /usr/share/cmake/Modules/Platform/Linux-GNU.cmake /usr/share/cmake/Modules/Platform/Linux-Initialize.cmake /usr/share/cmake/Modules/Platform/Linux.cmake /usr/share/cmake/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/4.3.2/CMakeCXXCompiler.cmake CMakeFiles/4.3.2/CMakeSystem.cmake + pool = console + + +############################################# +# A missing CMake input file is not an error. + +build /home/saqut/Masaüstü/saqutcompiler/CMakeLists.txt /usr/share/cmake/Modules/CMakeCXXInformation.cmake /usr/share/cmake/Modules/CMakeCommonLanguageInclude.cmake /usr/share/cmake/Modules/CMakeGenericSystem.cmake /usr/share/cmake/Modules/CMakeInitializeConfigs.cmake /usr/share/cmake/Modules/CMakeLanguageInformation.cmake /usr/share/cmake/Modules/CMakeSystemSpecificInformation.cmake /usr/share/cmake/Modules/CMakeSystemSpecificInitialize.cmake /usr/share/cmake/Modules/Compiler/CMakeCommonCompilerMacros.cmake /usr/share/cmake/Modules/Compiler/GNU-CXX.cmake /usr/share/cmake/Modules/Compiler/GNU.cmake /usr/share/cmake/Modules/Internal/CMakeCXXLinkerInformation.cmake /usr/share/cmake/Modules/Internal/CMakeCommonLinkerInformation.cmake /usr/share/cmake/Modules/Linker/GNU-CXX.cmake /usr/share/cmake/Modules/Linker/GNU.cmake /usr/share/cmake/Modules/Platform/Linker/GNU.cmake /usr/share/cmake/Modules/Platform/Linker/Linux-GNU-CXX.cmake /usr/share/cmake/Modules/Platform/Linker/Linux-GNU.cmake /usr/share/cmake/Modules/Platform/Linux-GNU-CXX.cmake /usr/share/cmake/Modules/Platform/Linux-GNU.cmake /usr/share/cmake/Modules/Platform/Linux-Initialize.cmake /usr/share/cmake/Modules/Platform/Linux.cmake /usr/share/cmake/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/4.3.2/CMakeCXXCompiler.cmake CMakeFiles/4.3.2/CMakeSystem.cmake: phony + + +############################################# +# Clean all the built files. + +build clean: CLEAN + + +############################################# +# Print all primary targets available. + +build help: HELP + + +############################################# +# Make the all target the default. + +default all diff --git a/build/cmake_install.cmake b/build/cmake_install.cmake new file mode 100644 index 0000000..65da676 --- /dev/null +++ b/build/cmake_install.cmake @@ -0,0 +1,66 @@ +# Install script for directory: /home/saqut/Masaüstü/saqutcompiler + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Debug") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set path to fallback-tool for dependency-resolution. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +if(CMAKE_INSTALL_LOCAL_ONLY) + file(WRITE "/home/saqut/Masaüstü/saqutcompiler/build/install_local_manifest.txt" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") +endif() +if(CMAKE_INSTALL_COMPONENT) + if(CMAKE_INSTALL_COMPONENT MATCHES "^[a-zA-Z0-9_.+-]+$") + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") + else() + string(MD5 CMAKE_INST_COMP_HASH "${CMAKE_INSTALL_COMPONENT}") + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INST_COMP_HASH}.txt") + unset(CMAKE_INST_COMP_HASH) + endif() +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + file(WRITE "/home/saqut/Masaüstü/saqutcompiler/build/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") +endif() diff --git a/fikirler.md b/docs/fikirler.md similarity index 100% rename from fikirler.md rename to docs/fikirler.md diff --git a/issues.md b/docs/issues.md similarity index 100% rename from issues.md rename to docs/issues.md diff --git a/prcontext.md b/docs/prcontext.md similarity index 100% rename from prcontext.md rename to docs/prcontext.md diff --git a/todo.md b/docs/todo.md similarity index 100% rename from todo.md rename to docs/todo.md diff --git a/Final.sqt b/examples/Final.sqt similarity index 100% rename from Final.sqt rename to examples/Final.sqt diff --git a/source.sqt b/examples/source.sqt similarity index 100% rename from source.sqt rename to examples/source.sqt diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..1e9496e --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e +PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )" +BUILD_DIR="$PROJECT_ROOT/build" +mkdir -p "$BUILD_DIR" +cd "$BUILD_DIR" +cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug .. +ninja +echo "Derleme başarılı: build/saqut" diff --git a/compile.sh b/scripts/compile.sh similarity index 100% rename from compile.sh rename to scripts/compile.sh diff --git a/src/core/sourcefile.cpp b/src/core/sourcefile.cpp new file mode 100644 index 0000000..2cbfa05 --- /dev/null +++ b/src/core/sourcefile.cpp @@ -0,0 +1,69 @@ +#include "core/sourcefile.hpp" + +void SourceFile::setText(const std::string& path, const std::string& source) { + filePath = path; + text = source; + computeLineStarts(); +} + +int SourceFile::lineCount() const { + return static_cast(lineStarts.size()); +} + +std::string SourceFile::getLine(int line) const { + if (line < 1 || line > lineCount()) return ""; + int start = lineStarts[line - 1]; + int end; + if (line < lineCount()) { + end = lineStarts[line] - 1; // Satır sonu (\n) hariç + // \r\n varsa bir karakter daha geri + if (end > start && text[end - 1] == '\r') end--; + } else { + end = static_cast(text.length()); + } + return text.substr(start, end - start); +} + +SourceLocation SourceFile::offsetToLocation(int offset) const { + // Geçersiz offset kontrolü + if (offset < 0 || offset > static_cast(text.length())) { + return SourceLocation{filePath, 0, 0, -1}; + } + + // Binary search: offset'in hangi satıra ait olduğunu bul + // lineStarts içinde offset'ten büyük ilk elemanı bul + auto it = std::upper_bound(lineStarts.begin(), lineStarts.end(), offset); + int lineIndex = static_cast(it - lineStarts.begin()) - 1; + + // lineIndex geçerli değilse + if (lineIndex < 0) { + lineIndex = 0; + } else if (lineIndex >= static_cast(lineStarts.size())) { + lineIndex = static_cast(lineStarts.size()) - 1; + } + + int lineStart = lineStarts[lineIndex]; + int line = lineIndex + 1; // 1-tabanlı + int column = offset - lineStart + 1; // 1-tabanlı + + return SourceLocation{filePath, line, column, offset}; +} + +SourceFile::LocationRange SourceFile::rangeFromOffsets(int startOffset, int endOffset) const { + return {offsetToLocation(startOffset), offsetToLocation(endOffset)}; +} + +void SourceFile::computeLineStarts() { + lineStarts.clear(); + lineStarts.push_back(0); // 1. satır offset 0 + + for (int i = 0; i < static_cast(text.length()); i++) { + if (text[i] == '\n') { + // \r\n kontrolü: \r'yi atla, \n'den sonraki karakter yeni satır + int nextStart = i + 1; + if (nextStart < static_cast(text.length())) { + lineStarts.push_back(nextStart); + } + } + } +} diff --git a/src/core/sourcefile.hpp b/src/core/sourcefile.hpp index 3205438..0c36cac 100644 --- a/src/core/sourcefile.hpp +++ b/src/core/sourcefile.hpp @@ -54,58 +54,17 @@ public: SourceFile() = default; // text verisini yeni satır dizisini de hesapla - void setText(const std::string& path, const std::string& source) { - filePath = path; - text = source; - computeLineStarts(); - } + void setText(const std::string& path, const std::string& source); // Kaynak kodun toplam satır sayısı - int lineCount() const { - return static_cast(lineStarts.size()); - } + int lineCount() const; // Belirtilen offset'teki satırın tam metnini döndür - std::string getLine(int line) const { - if (line < 1 || line > lineCount()) return ""; - int start = lineStarts[line - 1]; - int end; - if (line < lineCount()) { - end = lineStarts[line] - 1; // Satır sonu (\n) hariç - // \r\n varsa bir karakter daha geri - if (end > start && text[end - 1] == '\r') end--; - } else { - end = static_cast(text.length()); - } - return text.substr(start, end - start); - } + std::string getLine(int line) const; // Offset'ten (line, column) dönüşümü // Binary search ile O(log n) - SourceLocation offsetToLocation(int offset) const { - // Geçersiz offset kontrolü - if (offset < 0 || offset > static_cast(text.length())) { - return SourceLocation{filePath, 0, 0, -1}; - } - - // Binary search: offset'in hangi satıra ait olduğunu bul - // lineStarts içinde offset'ten büyük ilk elemanı bul - auto it = std::upper_bound(lineStarts.begin(), lineStarts.end(), offset); - int lineIndex = static_cast(it - lineStarts.begin()) - 1; - - // lineIndex geçerli değilse - if (lineIndex < 0) { - lineIndex = 0; - } else if (lineIndex >= static_cast(lineStarts.size())) { - lineIndex = static_cast(lineStarts.size()) - 1; - } - - int lineStart = lineStarts[lineIndex]; - int line = lineIndex + 1; // 1-tabanlı - int column = offset - lineStart + 1; // 1-tabanlı - - return SourceLocation{filePath, line, column, offset}; - } + SourceLocation offsetToLocation(int offset) const; // Bir aralığın başlangıç ve bitiş konumlarını döndür struct LocationRange { @@ -113,28 +72,13 @@ public: SourceLocation end; }; - LocationRange rangeFromOffsets(int startOffset, int endOffset) const { - return {offsetToLocation(startOffset), offsetToLocation(endOffset)}; - } + LocationRange rangeFromOffsets(int startOffset, int endOffset) const; private: // lineStarts vektörünü hesapla // Her \n karakterinden sonraki offset bir sonraki satırın başlangıcıdır // İlk satır her zaman offset 0'dan başlar - void computeLineStarts() { - lineStarts.clear(); - lineStarts.push_back(0); // 1. satır offset 0 - - for (int i = 0; i < static_cast(text.length()); i++) { - if (text[i] == '\n') { - // \r\n kontrolü: \r'yi atla, \n'den sonraki karakter yeni satır - int nextStart = i + 1; - if (nextStart < static_cast(text.length())) { - lineStarts.push_back(nextStart); - } - } - } - } + void computeLineStarts(); }; #endif // SAQUT_CORE_SOURCEFILE diff --git a/src/lexer/lexer.cpp b/src/lexer/lexer.cpp new file mode 100644 index 0000000..e00bbee --- /dev/null +++ b/src/lexer/lexer.cpp @@ -0,0 +1,346 @@ +#include "lexer/lexer.hpp" + +// -------------------------------------------------------------------------- +// beginPosition: Mevcut offset'i yığına kaydet. +// İç içe çağrılabilir: 3 kere beginPosition → 3 elemanlı yığın. +// -------------------------------------------------------------------------- +void Lexer::beginPosition() { + offsetMap.push_back(getLastPosition()); +} + +// -------------------------------------------------------------------------- +// getLastPosition: Yığının tepesindeki konumu döndür. +// Yığın boşsa mevcut offset'i döndür (başlangıç durumu). +// -------------------------------------------------------------------------- +int Lexer::getLastPosition() { + if (offsetMap.empty()) return offset; + return offsetMap.back(); +} + +// -------------------------------------------------------------------------- +// acceptPosition: Yığındaki son geçici konumu kalıcı yap. +// Örnek: offsetMap=[5,10], offset=15 → offsetMap.back()=10 olur. +// Bu sayede include() denemesi başarılı olduğunda konum ilerletilmiş olur. +// -------------------------------------------------------------------------- +void Lexer::acceptPosition() { + int t = offsetMap.back(); + setLastPosition(t); +} + +// -------------------------------------------------------------------------- +// setLastPosition: Yığının tepesini veya offset'i değiştir. +// -------------------------------------------------------------------------- +void Lexer::setLastPosition(int n) { + if (offsetMap.empty()) + offset = n; + else + offsetMap.back() = n; +} + +// -------------------------------------------------------------------------- +// isEnd: Dosya sonuna gelindi mi? offset >= size. +// -------------------------------------------------------------------------- +bool Lexer::isEnd() { + return size <= getOffset(); +} + +// -------------------------------------------------------------------------- +// rejectPosition: Yığındaki son konumu at. Başarısız include() denemesi sonrası. +// -------------------------------------------------------------------------- +void Lexer::rejectPosition() { + offsetMap.pop_back(); +} + +// -------------------------------------------------------------------------- +// positionRange: Yığındaki en dış ve en iç konumu [start, end] olarak döndür. +// UYARI: new int[2] ile heap'te tahsis eder. Çağıran sorumludur. +// TODO: std::pair veya yapı kullanarak tahsisi kaldır. +// -------------------------------------------------------------------------- +int* Lexer::positionRange() { + int len = offsetMap.size(); + if (len == 0) + return new int[2]{0, offset}; + if (len == 1) + return new int[2]{offset, offsetMap[0]}; + return new int[2]{offsetMap[len - 2], offsetMap[len - 1]}; +} + +// -------------------------------------------------------------------------- +// getPositionRange: positionRange() aralığındaki metni string olarak döndür. +// -------------------------------------------------------------------------- +std::string Lexer::getPositionRange() { + int* a = positionRange(); + std::string mem; + for (int i = a[0]; i < a[1]; i++) + mem.push_back(input.at(i)); + return mem; +} + +// -------------------------------------------------------------------------- +// include: Belirtilen kelime mevcut konumda başlıyor mu? +// -------------------------------------------------------------------------- +bool Lexer::include(std::string word, bool accept) { + beginPosition(); + for (size_t i = 0; i < word.size(); i++) { + if (isEnd()) { + rejectPosition(); + return false; + } + if (word[i] != getchar()) { + rejectPosition(); + return false; + } + nextChar(); + } + if (accept) + acceptPosition(); + else + rejectPosition(); + return true; +} + +// -------------------------------------------------------------------------- +// getOffset / setOffset: Konum erişimcileri. +// -------------------------------------------------------------------------- +int Lexer::getOffset() { + return getLastPosition(); +} + +int Lexer::setOffset(int n) { + setLastPosition(n); + return getLastPosition(); +} + +// -------------------------------------------------------------------------- +// getchar(additionalOffset): offset + ek kadar ilerideki karakteri oku. +// -------------------------------------------------------------------------- +char Lexer::getchar(int additionalOffset) { + int target = getOffset() + additionalOffset; + if (target >= size) { + std::cerr << "Lexer hatası: sınır aşımı\n"; + return '\0'; + } + return input.at(target); +} + +char Lexer::getchar() { + int target = getOffset(); + if (target >= size) { + std::cerr << "Lexer hatası: sınır aşımı\n"; + return '\0'; + } + return input.at(target); +} + +// -------------------------------------------------------------------------- +// nextChar / toChar: Konum ilerletme. +// -------------------------------------------------------------------------- +void Lexer::nextChar() { + if (!isEnd()) + setOffset(getOffset() + 1); +} + +void Lexer::toChar(int n) { + if (!isEnd()) + setOffset(getOffset() + n); +} + +// -------------------------------------------------------------------------- +// getLocation: Mevcut offset'in SourceLocation'ını döndür. +// -------------------------------------------------------------------------- +SourceLocation Lexer::getLocation() { + return sourceFile.offsetToLocation(getOffset()); +} + +// -------------------------------------------------------------------------- +// setSourceText: Yeni kaynak kodu yükle ve SourceFile'ı güncelle. +// -------------------------------------------------------------------------- +void Lexer::setSourceText(const std::string& path, const std::string& text) { + sourceFile.setText(path, text); + setText(text); +} + +// -------------------------------------------------------------------------- +// setText: Yeni kaynak kodu yükle. input ve size'ı günceller. +// -------------------------------------------------------------------------- +void Lexer::setText(std::string text) { + input = text; + size = static_cast(text.length()); +} + +// -------------------------------------------------------------------------- +// skipWhiteSpace: Boşluk, sekme, satırsonu, satırbaşı karakterlerini atla. +// -------------------------------------------------------------------------- +void Lexer::skipWhiteSpace() { + while (!isEnd()) { + switch (getchar()) { + case '\r': // carriage return (Windows satırsonu \r\n) + case '\n': // line feed (Unix satırsonu) + case '\b': // backspace + case '\t': // tab + case ' ': // boşluk + nextChar(); + break; + default: + return; + } + } +} + +// -------------------------------------------------------------------------- +// isNumeric: Mevcut karakter bir rakam mı? (0-9) +// -------------------------------------------------------------------------- +bool Lexer::isNumeric() { + char c = getchar(); + return (c >= '0' && c <= '9'); +} + +// -------------------------------------------------------------------------- +// readNumeric: Tam bir sayı literal'ı oku. +// -------------------------------------------------------------------------- +INumber Lexer::readNumeric() { + INumber num; + num.start = getLastPosition(); + num.startLoc = getLocation(); + + // --- Adım 1: İsteğe bağlı işaret --- + if (getchar() == '-') { + nextChar(); + num.positive = false; + } else if (getchar() == '+') { + nextChar(); + num.positive = true; + } else { + num.positive = true; + } + + // --- Adım 2: İlk karakter '0' ise özel format kontrolü --- + bool nextDot = false; + if (getchar() == '0') { + num.token.push_back('0'); + nextChar(); + char c = getchar(); + switch (c) { + case 'x': case 'X': // Hex: 0xFF, 0X1A + num.token.push_back(c); + num.base = 16; + nextChar(); + break; + case 'b': case 'B': // Binary: 0b1010 + num.token.push_back(c); + num.base = 2; + nextChar(); + break; + case '.': // Float: 0.5, 0.0 + num.token.push_back(c); + num.base = 10; + nextDot = true; + num.isFloat = true; + nextChar(); + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': + // Octal: 0777 — sonraki karakter octal rakam ise devam et + num.base = 8; + break; + default: + num.end = getLastPosition(); + num.endLoc = getLocation(); + return num; + } + } else { + num.base = 10; + } + + // --- Adım 3: Ana okuma döngüsü --- + while (!isEnd()) { + char c = getchar(); + switch (c) { + case '0': + case '1': + num.token.push_back(c); + break; + case '2': case '3': case '4': case '5': + case '6': case '7': + if (num.base >= 8) + num.token.push_back(c); + else { + num.end = getLastPosition(); + num.endLoc = getLocation(); + return num; + } + break; + case '8': case '9': + if (num.base >= 10) + num.token.push_back(c); + else { + num.end = getLastPosition(); + num.endLoc = getLocation(); + return num; + } + break; + case 'a': case 'A': case 'b': case 'B': + case 'c': case 'C': case 'd': case 'D': + case 'f': case 'F': + if (num.base >= 16) + num.token.push_back(c); + else { + num.end = getLastPosition(); + num.endLoc = getLocation(); + return num; + } + break; + case '.': + if (!nextDot) { + if (num.token.empty()) + num.token += "0."; + else + num.token.push_back('.'); + nextDot = true; + num.isFloat = true; + } else { + num.end = getLastPosition(); + num.endLoc = getLocation(); + return num; + } + break; + case 'e': case 'E': + if (num.base == 16) { + num.token.push_back(c); + break; + } + if (num.base == 10) { + num.hasEpsilon = true; + num.token.push_back(c); + nextChar(); + c = getchar(); + if (c == '+' || c == '-') { + num.token.push_back(c); + nextChar(); + } + while (!isEnd()) { + c = getchar(); + if (c >= '0' && c <= '9') { + num.token.push_back(c); + nextChar(); + } else { + num.end = getLastPosition(); + num.endLoc = getLocation(); + return num; + } + } + break; + } + num.end = getLastPosition(); + num.endLoc = getLocation(); + return num; + default: + num.end = getLastPosition(); + return num; + } + nextChar(); + } + num.end = getLastPosition(); + num.endLoc = getLocation(); + return num; +} diff --git a/src/lexer/lexer.hpp b/src/lexer/lexer.hpp index e12f898..3a45220 100644 --- a/src/lexer/lexer.hpp +++ b/src/lexer/lexer.hpp @@ -15,46 +15,6 @@ // 4. Boşluk karakterlerini atlar // 5. Satır/sütun bilgisi sağlar (hata mesajları için temel) // -// ADR-006: Neden Kendi Lexer'ımız? -// - std::istringstream veya regex kullanmak yerine, tam kontrol sağlayan -// sıfırdan bir lexer yazdık. -// - Backtracking: offsetMap ile konum yığını tutar, denenen bir eşleşme -// başarısız olursa geri alınabilir. Bu özellik std::istream'de yoktur. -// - Performans: Sanal fonksiyon çağrısı yok, her şey inline. -// - Hata ayıklama: Her karakter okuması kontrol edilebilir. -// -// TASARIM KARARLARI: -// 1. offsetMap (std::vector): İç içe backtracking için yığın. -// beginPosition() → yığına mevcut konumu ekler -// acceptPosition() → yığındaki son konumu kalıcı yapar -// rejectPosition() → yığındaki son konumu atar (geri al) -// Bu sayede "dene, başarısız olursa geri al" patterni çalışır. -// -// 2. getchar() iki overload: -// - getchar(): mevcut konumdaki karakteri okur -// - getchar(int offset): mevcut konum + offset'teki karakteri okur -// İkincisi özellikle keyword kontrolünde önemlidir: -// "do" kelimesini gördükten sonra, bunun "double"ın başlangıcı olmadığını -// kontrol etmek için keyword sonrası karaktere bakılır. -// -// 3. isEnd(): offset >= size ile kontrol. offset her zaman [0, size] aralığında. -// size konumunda EOF (end of file) anlamına gelir. -// -// 4. readNumeric(): C/C++/Java sayı formatlarını destekler: -// - Decimal: 42, -3, +7 -// - Hex: 0xFF, 0X1A -// - Binary: 0b1010, 0B1100 -// - Octal: 0777 (0 ile başlayan ve 8-9 içermeyen) -// - Float: 3.14, .5, 1e10, 2.5E-3 -// - Negatif/Pozitif: -42, +3 (baştaki işaret) -// -// BİLİNEN SINIRLAMALAR (TODO): -// TODO: Satır/sütun takibi eklenmeli (şu anda sadece offset var) -// TODO: Unicode/UTF-8 desteği (şu anda sadece ASCII) -// TODO: ' char literal'ı okunamıyor -// TODO: Sayısal alt çizgi (_) ayracı: 1_000_000 formatı -// TODO: Binary floating point: 0b1.1p10 formatı (C99 hexfloat) -// // ============================================================================ #ifndef SAQUT_LEXER @@ -69,25 +29,7 @@ // ============================================================================ // INumber — Ara Sayısal Veri Yapısı // ============================================================================ -// -// Lexer'ın readNumeric() fonksiyonu tarafından döndürülür. -// Tokenizer bu yapıyı NumberToken'a dönüştürür. -// -// Neden ayrı bir struct? Lexer katmanı Token sınıflarından haberdar değil. -// Bağımlılık yönü: Lexer ← Tokenizer. Lexer hiçbir üst katmanı include etmez. -// -// ALANLAR: -// start, end : Kaynak koddaki başlangıç/bitiş konumları (offset) -// token : Sayının ham string hali (örn: "0xFF", "3.14", "1e10") -// isFloat : Ondalıklı sayı mı? (nokta veya epsilon içeriyor mu) -// hasEpsilon : Bilimsel gösterim mi? (e/E içeriyor mu) -// base : Sayı tabanı: 2, 8, 10, veya 16 -// - 0x/0X ile başlarsa 16 -// - 0b/0B ile başlarsa 2 -// - 0 ile başlayıp 8-9 içermiyorsa 8 -// - diğer her şey 10 -// positive : Pozitif mi? (başında - işareti yoksa true) -// + struct INumber { int start = 0; // Kaynak koddaki başlangıç offset'i int end = 0; // Kaynak koddaki bitiş offset'i @@ -103,21 +45,7 @@ struct INumber { // ============================================================================ // Lexer — Karakter Seviyesinde Tarayıcı // ============================================================================ -// -// Derleyici pipeline'ının en alt katmanı. Ham string üzerinde çalışır. -// Üst katmanlara (Tokenizer) karakter okuma ve konum yönetimi hizmeti sunar. -// -// DURUM DEĞİŞKENLERİ: -// input : Taranan kaynak kodun tamamı (string kopyası, değişmez) -// size : input.length() önbelleği (performans: her seferinde hesaplamaz) -// offset : Mevcut okuma konumu. 0 = ilk karakter, size = EOF -// offsetMap : Backtracking yığını. İç içe beginPosition/acceptPosition/rejectPosition -// -// PERFORMANS NOTU: -// Tüm metotlar inline tanımlanmıştır. Sanal fonksiyon çağrısı yoktur. -// offset değişiklikleri O(1)'dir. -// include() metodu O(n) karakter karşılaştırması yapar (n = kelime uzunluğu). -// + class Lexer { public: // --- Ham Veri --- @@ -127,14 +55,6 @@ public: std::vector offsetMap; // Backtracking yığını // --- Pozisyon Yönetimi (Backtracking API) --- - // - // Kullanım örneği: - // lexer.beginPosition(); // konumu kaydet - // if (lexer.include("for", false)) // dene (false = eşleşse de geri al) - // lexer.acceptPosition(); // başarılı → kalıcı yap - // else - // lexer.rejectPosition(); // başarısız → geri al - void beginPosition(); // Şu anki konumu yığına kaydet int getLastPosition(); // Yığındaki son konumu döndür void acceptPosition(); // Yığındaki son konumu kalıcı yap (apply) @@ -147,10 +67,6 @@ public: std::string getPositionRange(); // Pozisyon aralığındaki metni döndür // --- Desen Eşleme --- - // include(): Belirtilen kelime mevcut konumda başlıyor mu? - // accept=true (varsayılan): eşleşirse konum ilerletilir - // accept=false: eşleşse bile konum geri alınır (keyword kontrolü için) - // Örnek: include("for", false) → "for" ile başlıyor mu? konumu değiştirme. bool include(std::string word, bool accept = true); // --- Konum Okuma/Yazma --- @@ -164,7 +80,6 @@ public: void toChar(int n); // offset'i n kadar ilerlet // --- Üst Seviye İşlemler --- - // --- Konum Bilgisi (SourceFile üzerinden) --- SourceFile sourceFile; // Kaynak kod ve satır başı offset'leri SourceLocation getLocation(); // Mevcut offset'in SourceLocation'ını döndür void setSourceText(const std::string& path, const std::string& text); @@ -175,423 +90,4 @@ public: INumber readNumeric(); // Sayı literal'ı oku ve INumber olarak döndür }; -// ============================================================================ -// GERÇEKLEME (Implementation) -// ============================================================================ -// Tüm metotlar inline olarak aşağıda tanımlanmıştır. -// Derleme modeli: header-only. main.cpp bu dosyayı include eder. -// ============================================================================ - -// -------------------------------------------------------------------------- -// beginPosition: Mevcut offset'i yığına kaydet. -// İç içe çağrılabilir: 3 kere beginPosition → 3 elemanlı yığın. -// -------------------------------------------------------------------------- -inline void Lexer::beginPosition() { - offsetMap.push_back(getLastPosition()); -} - -// -------------------------------------------------------------------------- -// getLastPosition: Yığının tepesindeki konumu döndür. -// Yığın boşsa mevcut offset'i döndür (başlangıç durumu). -// -------------------------------------------------------------------------- -inline int Lexer::getLastPosition() { - if (offsetMap.empty()) return offset; - return offsetMap.back(); -} - -// -------------------------------------------------------------------------- -// acceptPosition: Yığındaki son geçici konumu kalıcı yap. -// Örnek: offsetMap=[5,10], offset=15 → offsetMap.back()=10 olur. -// Bu sayede include() denemesi başarılı olduğunda konum ilerletilmiş olur. -// -------------------------------------------------------------------------- -inline void Lexer::acceptPosition() { - int t = offsetMap.back(); - setLastPosition(t); -} - -// -------------------------------------------------------------------------- -// setLastPosition: Yığının tepesini veya offset'i değiştir. -// -------------------------------------------------------------------------- -inline void Lexer::setLastPosition(int n) { - if (offsetMap.empty()) - offset = n; - else - offsetMap.back() = n; -} - -// -------------------------------------------------------------------------- -// isEnd: Dosya sonuna gelindi mi? offset >= size. -// -------------------------------------------------------------------------- -inline bool Lexer::isEnd() { - return size <= getOffset(); -} - -// -------------------------------------------------------------------------- -// rejectPosition: Yığındaki son konumu at. Başarısız include() denemesi sonrası. -// -------------------------------------------------------------------------- -inline void Lexer::rejectPosition() { - offsetMap.pop_back(); -} - -// -------------------------------------------------------------------------- -// positionRange: Yığındaki en dış ve en iç konumu [start, end] olarak döndür. -// UYARI: new int[2] ile heap'te tahsis eder. Çağıran sorumludur. -// TODO: std::pair veya yapı kullanarak tahsisi kaldır. -// -------------------------------------------------------------------------- -inline int* Lexer::positionRange() { - int len = offsetMap.size(); - if (len == 0) - return new int[2]{0, offset}; - if (len == 1) - return new int[2]{offset, offsetMap[0]}; - return new int[2]{offsetMap[len - 2], offsetMap[len - 1]}; -} - -// -------------------------------------------------------------------------- -// getPositionRange: positionRange() aralığındaki metni string olarak döndür. -// -------------------------------------------------------------------------- -inline std::string Lexer::getPositionRange() { - int* a = positionRange(); - std::string mem; - for (int i = a[0]; i < a[1]; i++) - mem.push_back(input.at(i)); - return mem; -} - -// -------------------------------------------------------------------------- -// include: Belirtilen kelime mevcut konumda başlıyor mu? -// -// Algoritma: -// 1. beginPosition() ile konumu kaydet -// 2. Kelimenin her karakterini sırayla karşılaştır -// 3. Eşleşmezse veya EOF olursa → rejectPosition() ve false dön -// 4. Tüm karakterler eşleşirse: -// - accept=true ise → acceptPosition() (konum kalıcı ilerler) -// - accept=false ise → rejectPosition() (konum eski haline döner) -// 5. true dön -// -// Neden accept parametresi var? -// Tokenizer scope() fonksiyonu, keyword'leri kontrol ederken accept=false -// kullanır. Çünkü bir keyword eşleşmesi, aynı zamanda daha uzun bir -// keyword'ün parçası olabilir (örn: "do", "double"ın başlangıcı). -// Eğer include("do", true) kullanılırsa, konum ilerler ve geri alınamaz. -// -------------------------------------------------------------------------- -inline bool Lexer::include(std::string word, bool accept) { - beginPosition(); - for (size_t i = 0; i < word.size(); i++) { - if (isEnd()) { - rejectPosition(); - return false; - } - if (word[i] != getchar()) { - rejectPosition(); - return false; - } - nextChar(); - } - if (accept) - acceptPosition(); - else - rejectPosition(); - return true; -} - -// -------------------------------------------------------------------------- -// getOffset / setOffset: Konum erişimcileri. -// -------------------------------------------------------------------------- -inline int Lexer::getOffset() { - return getLastPosition(); -} - -inline int Lexer::setOffset(int n) { - setLastPosition(n); - return getLastPosition(); -} - -// -------------------------------------------------------------------------- -// getchar(additionalOffset): offset + ek kadar ilerideki karakteri oku. -// Sınır kontrolü yapar: target >= size ise '\0' döndürür ve hata mesajı basar. -// Bu metot özellikle keyword sınır kontrolünde kullanılır: -// "do" eşleşti, sıradaki karakter 'u' ise bu "double" olabilir → keyword değil -// -------------------------------------------------------------------------- -inline char Lexer::getchar(int additionalOffset) { - int target = getOffset() + additionalOffset; - if (target >= size) { - std::cerr << "Lexer hatası: sınır aşımı\n"; - return '\0'; - } - return input.at(target); -} - -inline char Lexer::getchar() { - int target = getOffset(); - if (target >= size) { - std::cerr << "Lexer hatası: sınır aşımı\n"; - return '\0'; - } - return input.at(target); -} - -// -------------------------------------------------------------------------- -// nextChar / toChar: Konum ilerletme. -// EOF kontrolü yapar — dosya sonundaysa ilerlemez. -// -------------------------------------------------------------------------- -inline void Lexer::nextChar() { - if (!isEnd()) - setOffset(getOffset() + 1); -} - -inline void Lexer::toChar(int n) { - if (!isEnd()) - setOffset(getOffset() + n); -} - -// -------------------------------------------------------------------------- -// getLocation: Mevcut offset'in SourceLocation'ını döndür. -// sourceFile bağlı değilse offset+dosya adı olmadan temel bilgi döndür. -// -------------------------------------------------------------------------- -inline SourceLocation Lexer::getLocation() { - return sourceFile.offsetToLocation(getOffset()); -} - -// -------------------------------------------------------------------------- -// setSourceText: Yeni kaynak kodu yükle ve SourceFile'ı güncelle. -// Aynı anda Lexer ve SourceFile'ı hazırlar. -// -------------------------------------------------------------------------- -inline void Lexer::setSourceText(const std::string& path, const std::string& text) { - sourceFile.setText(path, text); - setText(text); -} - -// -------------------------------------------------------------------------- -// setText: Yeni kaynak kodu yükle. input ve size'ı günceller. -// -------------------------------------------------------------------------- -inline void Lexer::setText(std::string text) { - input = text; - size = text.length(); -} - -// -------------------------------------------------------------------------- -// skipWhiteSpace: Boşluk, sekme, satırsonu, satırbaşı karakterlerini atla. -// Yorum satırlarını atlamaz — bu Tokenizer'ın işi. -// -------------------------------------------------------------------------- -inline void Lexer::skipWhiteSpace() { - while (!isEnd()) { - switch (getchar()) { - case '\r': // carriage return (Windows satırsonu \r\n) - case '\n': // line feed (Unix satırsonu) - case '\b': // backspace - case '\t': // tab - case ' ': // boşluk - nextChar(); - break; - default: - return; - } - } -} - -// -------------------------------------------------------------------------- -// isNumeric: Mevcut karakter bir rakam mı? (0-9) -// Pointer aritmetiği veya ASCII tablosu karşılaştırması yerine basit aralık -// kontrolü. Performans: O(1), branchless (modern derleyiciler optimize eder). -// -------------------------------------------------------------------------- -inline bool Lexer::isNumeric() { - char c = getchar(); - return (c >= '0' && c <= '9'); -} - -// -------------------------------------------------------------------------- -// readNumeric: Tam bir sayı literal'ı oku. -// -// Desteklenen formatlar (öncelik sırasıyla): -// 1. İşaret: -42, +3 (baştaki isteğe bağlı işaret) -// 2. 0x/0X: Hex (0xFF, 0X1A) -// 3. 0b/0B: Binary (0b1010) -// 4. 0 ile başlayan: Octal (0777) veya Float (0.5) -// 5. Ondalık: 42, 3.14 -// 6. Bilimsel: 1e10, 2.5E-3, 1.0e+5 -// -// Algoritma: -// 1. İsteğe bağlı işareti oku (+ veya -) -// 2. İlk karakter '0' ise → özel durum (hex/bin/octal/float kontrolü) -// 3. Ana döngü: rakamları, hex harflerini (a-f/A-F), nokta (.), epsilon (e/E) oku -// 4. Her karakterde taban uygunluğunu kontrol et (örn: octal'da 8-9 geçersiz) -// 5. İlk karakter '0' değilse → doğrudan decimal -// -// Özel durum: "0" takip eden karakter yoksa → tek haneli sayı, base=10. -// "0xFF" → hex, "0b10" → binary, "077" → octal, "0.5" → float. -// -// TODO: Hex float desteği (0x1.ffp10) — C99 standardı -// TODO: Sayısal ayraç: 1_000_000 — C++14/Java 7 -// -------------------------------------------------------------------------- -inline INumber Lexer::readNumeric() { - INumber num; - num.start = getLastPosition(); - num.startLoc = getLocation(); - - // --- Adım 1: İsteğe bağlı işaret --- - if (getchar() == '-') { - nextChar(); - num.positive = false; - } else if (getchar() == '+') { - nextChar(); - num.positive = true; - } else { - num.positive = true; - } - - // --- Adım 2: İlk karakter '0' ise özel format kontrolü --- - bool nextDot = false; - if (getchar() == '0') { - num.token.push_back('0'); - nextChar(); - char c = getchar(); - switch (c) { - case 'x': case 'X': // Hex: 0xFF, 0X1A - num.token.push_back(c); - num.base = 16; - nextChar(); - break; - case 'b': case 'B': // Binary: 0b1010 - num.token.push_back(c); - num.base = 2; - nextChar(); - break; - case '.': // Float: 0.5, 0.0 - num.token.push_back(c); - num.base = 10; - nextDot = true; - num.isFloat = true; - nextChar(); - break; - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': - // Octal: 0777 — sonraki karakter octal rakam ise devam et - num.base = 8; - break; - default: - // Sadece "0" — takip eden karakter rakam değil. - // Hemen dön: base=10 (varsayılan). - // BUG FIX (commit 438bc0e): Eskiden bu dalda sıradaki karakter - // token'a ekleniyor ve base=8 yapılıyordu. Bu, "0;" durumunda - // ';' karakterinin sayıya eklenmesine neden oluyordu. - num.end = getLastPosition(); - num.endLoc = getLocation(); - return num; - } - } else { - num.base = 10; - } - - // --- Adım 3: Ana okuma döngüsü --- - // Bu döngü, geçerli tabana uygun tüm karakterleri okur. - // Her karakter tipi için taban uygunluğu kontrol edilir: - // - 0-1: tüm tabanlar - // - 2-7: base >= 8 - // - 8-9: base >= 10 - // - a-f/A-F: base >= 16 - // - . (nokta): sadece ondalık, sadece bir kere - // - e/E: sadece ondalık ve hex (hex'te epsilon yok, direkt okunur) - while (!isEnd()) { - char c = getchar(); - switch (c) { - case '0': - case '1': - num.token.push_back(c); - break; - case '2': case '3': case '4': case '5': - case '6': case '7': - if (num.base >= 8) - num.token.push_back(c); - else { - num.end = getLastPosition(); - num.endLoc = getLocation(); - return num; - } - break; - case '8': case '9': - if (num.base >= 10) - num.token.push_back(c); - else { - num.end = getLastPosition(); - num.endLoc = getLocation(); - return num; - } - break; - case 'a': case 'A': case 'b': case 'B': - case 'c': case 'C': case 'd': case 'D': - case 'f': case 'F': - if (num.base >= 16) - num.token.push_back(c); - else { - num.end = getLastPosition(); - num.endLoc = getLocation(); - return num; - } - break; - case '.': - // Nokta: Sadece bir kere izin verilir. - // .5 gibi başıboş noktalı sayılar için "0." öneki eklenir. - if (!nextDot) { - if (num.token.empty()) - num.token += "0."; - else - num.token.push_back('.'); - nextDot = true; - num.isFloat = true; - } else { - // İkinci nokta → sayı bitti - num.end = getLastPosition(); - num.endLoc = getLocation(); - return num; - } - break; - case 'e': case 'E': - // Epsilon (bilimsel gösterim): - // - Hex tabanda: epsilon DEĞİL, hex hanesi olarak okunur. - // - Decimal tabanda: 1e10, 2.5E-3 formatı. - if (num.base == 16) { - num.token.push_back(c); - break; - } - if (num.base == 10) { - num.hasEpsilon = true; - num.token.push_back(c); - nextChar(); - c = getchar(); - // İsteğe bağlı işaret: e+10, E-3 - if (c == '+' || c == '-') { - num.token.push_back(c); - nextChar(); - } - // Epsilon sonrası rakamları oku - while (!isEnd()) { - c = getchar(); - if (c >= '0' && c <= '9') { - num.token.push_back(c); - nextChar(); - } else { - num.end = getLastPosition(); - num.endLoc = getLocation(); - return num; - } - } - break; - } - num.end = getLastPosition(); - num.endLoc = getLocation(); - return num; - default: - // Tanınmayan karakter → sayı bitti - num.end = getLastPosition(); - return num; - } - nextChar(); - } - num.end = getLastPosition(); - num.endLoc = getLocation(); - return num; -} - -#endif // SAQUT_LEXER \ No newline at end of file +#endif // SAQUT_LEXER diff --git a/src/parser/ast.hpp b/src/parser/ast.hpp index 8549003..d1910a1 100644 --- a/src/parser/ast.hpp +++ b/src/parser/ast.hpp @@ -1,45 +1,13 @@ -// ============================================================================ -// saQut Compiler — Soyut Sözdizim Ağacı (Aggregator) -// ============================================================================ -// -// DİZİN: src/parser/ast.hpp -// KATMAN: Katman 3 — Parser'ın ürettiği, IR'nin tükettiği -// -// Bu dosya bir AGGREGATOR'dür. Tüm AST düğüm sınıflarını tek bir include -// ile kullanılabilir yapar. -// -// AST DÜĞÜM HİYERARŞİSİ: -// ASTNode (soyut taban) — ast_node.hpp -// ├── ProgramNode : Kök düğüm — ast_decl.hpp -// ├── FunctionDeclNode : Fonksiyon tanımı — ast_decl.hpp -// ├── StructDeclNode : struct tanımı — ast_decl.hpp -// ├── VariableDeclNode : Değişken tanımı — ast_decl.hpp -// ├── BlockNode : { ... } bloğu — ast_stmt.hpp -// ├── IfStatementNode : if/else — ast_stmt.hpp -// ├── WhileStatementNode : while — ast_stmt.hpp -// ├── ForStatementNode : for — ast_stmt.hpp -// ├── DoWhileStatementNode : do-while — ast_stmt.hpp -// ├── ReturnStatementNode : return — ast_stmt.hpp -// ├── BreakStatementNode : break — ast_stmt.hpp -// ├── ContinueStatementNode : continue — ast_stmt.hpp -// ├── ExpressionStatementNode: expression; — ast_stmt.hpp -// ├── BinaryExpressionNode : a + b — ast_expr.hpp -// ├── LiteralNode : 42, "hello" — ast_expr.hpp -// ├── IdentifierNode : değişken ismi — ast_expr.hpp -// ├── PostfixNode : a++ — ast_expr.hpp -// ├── CallExpressionNode : f(x) — ast_expr.hpp -// ├── MemberAccessNode : a.b — ast_expr.hpp -// └── IndexExpressionNode : a[i] — ast_expr.hpp -// -// ============================================================================ - #ifndef SAQUT_AST #define SAQUT_AST #include "parser/ast_node.hpp" -#include "parser/ast_json.hpp" -#include "parser/ast_expr.hpp" -#include "parser/ast_stmt.hpp" -#include "parser/ast_decl.hpp" +#include "parser/nodes/program.hpp" +#include "parser/nodes/declarations.hpp" +#include "parser/nodes/statements.hpp" +#include "parser/nodes/binary_expr.hpp" +#include "parser/nodes/literal.hpp" +#include "parser/nodes/identifier.hpp" +#include "parser/nodes/expressions.hpp" -#endif // SAQUT_AST +#endif diff --git a/src/parser/ast_decl.hpp b/src/parser/ast_decl.hpp deleted file mode 100644 index 5602698..0000000 --- a/src/parser/ast_decl.hpp +++ /dev/null @@ -1,143 +0,0 @@ -// ============================================================================ -// saQut Compiler — AST Deklarasyon Düğümleri -// ============================================================================ -// -// DİZİN: src/parser/ast_decl.hpp -// İÇERİK: ProgramNode, FunctionDeclNode, VariableDeclNode, StructDeclNode -// -// ============================================================================ - -#ifndef SAQUT_AST_DECL -#define SAQUT_AST_DECL - -#include -#include -#include -#include "parser/ast_node.hpp" -#include "parser/ast_json.hpp" -class ProgramNode : public ASTNode { -public: - ProgramNode() { kind = ASTKind::Program; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "Program\n"; - for (auto* c : getChildren()) c->log(indent + 2); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"Program\",\n" - << in << " \"children\": [\n" - << childrenToJson(this, depth + 3) - << in << " ]\n" - << in << "}"; - return ss.str(); - } -}; - -class FunctionDeclNode : public ASTNode { -public: - std::string name; - std::string returnType; - - FunctionDeclNode() { kind = ASTKind::FunctionDecl; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) - << "FunctionDecl " << returnType << " " << name << "()\n"; - for (auto* c : getChildren()) c->log(indent + 2); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"FunctionDecl\",\n" - << in << " \"name\": \"" << jsonEscape(name) << "\",\n" - << in << " \"returnType\": \"" << jsonEscape(returnType) << "\",\n" - << in << " \"location\": " << loc.toJson() << ",\n" - << in << " \"children\": [\n" - << childrenToJson(this, depth + 3) - << in << " ]\n" - << in << "}"; - return ss.str(); - } -}; - -class VariableDeclNode : public ASTNode { -public: - std::string varType; - std::string name; - ASTNode* initExpr = nullptr; - - VariableDeclNode() { kind = ASTKind::VariableDecl; } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"VariableDecl\",\n" - << in << " \"name\": \"" << jsonEscape(name) << "\",\n" - << in << " \"varType\": \"" << jsonEscape(varType) << "\",\n" - << in << " \"location\": " << loc.toJson() << ""; - if (initExpr) { - ss << ",\n" << in << " \"initExpr\":\n" - << initExpr->toJson(depth + 2); - } - // Çoklu değişken bildirimindeki kardeşler (int a, b, c;) - if (!getChildren().empty()) { - ss << ",\n" << in << " \"declarators\": [\n"; - for (size_t i = 0; i < getChildren().size(); i++) { - ss << ((VariableDeclNode*)getChildren()[i])->toJson(depth + 2); - if (i + 1 < getChildren().size()) ss << ","; - ss << "\n"; - } - ss << in << " ]"; - } - ss << "\n" << in << "}"; - return ss.str(); - } - - void log(int indent = 0) override { - std::cout << padRight("", indent) - << "VariableDecl " << varType << " " << name; - if (initExpr) { - std::cout << " =\n"; - initExpr->log(indent + 4); - } else { - std::cout << "\n"; - } - // Kardeş değişkenleri de logla - for (auto* child : getChildren()) { - child->log(indent); - } - } -}; - -class StructDeclNode : public ASTNode { -public: - std::string name; - - StructDeclNode() { kind = ASTKind::StructDecl; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "StructDecl " << name << "\n"; - for (auto* c : getChildren()) c->log(indent + 2); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"StructDecl\",\n" - << in << " \"name\": \"" << jsonEscape(name) << "\",\n" - << in << " \"children\": [\n" - << childrenToJson(this, depth + 3) - << in << " ]\n" - << in << "}"; - return ss.str(); - } -}; -#endif // SAQUT_AST_DECL diff --git a/src/parser/ast_expr.hpp b/src/parser/ast_expr.hpp deleted file mode 100644 index 4455260..0000000 --- a/src/parser/ast_expr.hpp +++ /dev/null @@ -1,287 +0,0 @@ -// ============================================================================ -// saQut Compiler — AST İfade Düğümleri -// ============================================================================ -// -// DİZİN: src/parser/ast_expr.hpp -// İÇERİK: BinaryExpr, Literal, Identifier, Postfix, -// CallExpression, MemberAccess, IndexExpression -// -// ============================================================================ - -#ifndef SAQUT_AST_EXPR -#define SAQUT_AST_EXPR - -#include -#include -#include -#include "parser/ast_node.hpp" -#include "parser/ast_json.hpp" -class BinaryExpressionNode : public ASTNode { -public: - TokenType Operator; - ASTNode* Left = nullptr; - ASTNode* Right = nullptr; - - BinaryExpressionNode() { kind = ASTKind::BinaryExpression; } - - void log(int indent = 0) override { - auto it = OPERATOR_MAP_STRREV.find(Operator); - std::string sym = (it != OPERATOR_MAP_STRREV.end()) ? std::string(it->second) : "?"; - std::string val; - auto it2 = OPERATOR_MAP_REV.find(Operator); - if (it2 != OPERATOR_MAP_REV.end()) val = std::string(it2->second); - - std::cout << padRight("", indent) << "BinaryExpr " << sym - << " (" << val << ")\n"; - if (Right) Right->log(indent + 2); - if (Left) Left->log(indent + 2); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::string opSym = "?"; - auto it = OPERATOR_MAP_REV.find(Operator); - if (it != OPERATOR_MAP_REV.end()) opSym = std::string(it->second); - - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"BinaryExpression\",\n" - << in << " \"operator\": \"" << jsonEscape(opSym) << "\",\n" - << in << " \"location\": " << loc.toJson() << ""; - if (Left) { - ss << ",\n" << in << " \"left\":\n" - << Left->toJson(depth + 2); - } - if (Right) { - ss << ",\n" << in << " \"right\":\n" - << Right->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - -// LiteralType enum'u ve literalTypeToString ast_node.hpp'de tanımlıdır. - -class LiteralNode : public ASTNode { -public: - Token* lexerToken = nullptr; - ParserToken parserToken; - - LiteralType literalType = LiteralType::INTEGER; - int literalBase = 10; // 10, 16, 8, 2 (sadece INTEGER/FLOAT için) - bool isFloatValue = false; // Ondalıklı mı? (sadece INTEGER/FLOAT için) - - LiteralNode() { kind = ASTKind::Literal; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) - << "Literal {" << parserToken.token->token << "} " - << literalTypeToString(literalType); - if (literalType == LiteralType::INTEGER && literalBase != 10) - std::cout << " (base " << literalBase << ")"; - std::cout << "\n"; - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::string val = parserToken.token ? parserToken.token->token : "?"; - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"Literal\",\n" - << in << " \"literalType\": \"" << literalTypeToString(literalType) << "\",\n" - << in << " \"value\": \"" << jsonEscape(val) << "\""; - if (literalType == LiteralType::INTEGER && literalBase != 10) { - ss << ",\n" << in << " \"base\": " << literalBase; - } - if (literalType == LiteralType::FLOAT) { - ss << ",\n" << in << " \"isFloat\": true"; - } - ss << ",\n" << in << " \"location\": " << loc.toJson() << "\n" - << in << "}"; - return ss.str(); - } -}; - -class IdentifierNode : public ASTNode { -public: - Token* lexerToken = nullptr; - ParserToken parserToken; - - IdentifierNode() { kind = ASTKind::Identifier; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) - << "Identifier {" << parserToken.token->token << "}\n"; - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::string name = parserToken.token ? parserToken.token->token : "?"; - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"Identifier\",\n" - << in << " \"name\": \"" << jsonEscape(name) << "\",\n" - << in << " \"location\": " << loc.toJson() << "\n" - << in << "}"; - return ss.str(); - } -}; - -class PostfixNode : public ASTNode { -public: - ASTNode* operand = nullptr; - TokenType Operator; - - PostfixNode() { kind = ASTKind::Postfix; } - - void log(int indent = 0) override { - auto it = OPERATOR_MAP_STRREV.find(Operator); - std::string sym = (it != OPERATOR_MAP_STRREV.end()) ? std::string(it->second) : "?"; - std::cout << padRight("", indent) << "Postfix " << sym; - auto it2 = OPERATOR_MAP_REV.find(Operator); - if (it2 != OPERATOR_MAP_REV.end()) - std::cout << " (" << it2->second << ")"; - std::cout << "\n"; - if (operand) operand->log(indent + 2); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::string opSym = "?"; - auto it = OPERATOR_MAP_REV.find(Operator); - if (it != OPERATOR_MAP_REV.end()) opSym = std::string(it->second); - - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"Postfix\",\n" - << in << " \"operator\": \"" << jsonEscape(opSym) << "\""; - if (operand) { - ss << ",\n" << in << " \"operand\":\n" - << operand->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - -class CallExpressionNode : public ASTNode { -public: - ASTNode* callee = nullptr; - std::vector arguments; - - CallExpressionNode() { kind = ASTKind::Call; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "Call\n"; - if (callee) { - std::cout << padRight("", indent + 2) << "Callee:\n"; - callee->log(indent + 4); - } - std::cout << padRight("", indent + 2) << "Args (" << arguments.size() << "):\n"; - for (auto* a : arguments) a->log(indent + 4); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"Call\""; - if (callee) { - ss << ",\n" << in << " \"callee\":\n" - << callee->toJson(depth + 2); - } - ss << ",\n" << in << " \"arguments\": [\n"; - for (size_t i = 0; i < arguments.size(); i++) { - ss << arguments[i]->toJson(depth + 3); - if (i + 1 < arguments.size()) ss << ","; - ss << "\n"; - } - ss << in << " ]\n" << in << "}"; - return ss.str(); - } -}; - -// ============================================================================ -// MemberAccessNode — Üye Erişimi a.b veya a->b -// ============================================================================ - - -class MemberAccessNode : public ASTNode { -public: - ASTNode* object = nullptr; - std::string member; - bool arrow = false; - - MemberAccessNode() { kind = ASTKind::MemberAccess; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "MemberAccess " - << (arrow ? "->" : ".") << " " << member << "\n"; - if (object) object->log(indent + 2); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"MemberAccess\",\n" - << in << " \"member\": \"" << jsonEscape(member) << "\",\n" - << in << " \"arrow\": " << (arrow ? "true" : "false"); - if (object) { - ss << ",\n" << in << " \"object\":\n" - << object->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - -// ============================================================================ -// IndexExpressionNode — Dizi Erişimi a[i] -// ============================================================================ - - -class IndexExpressionNode : public ASTNode { -public: - ASTNode* object = nullptr; - ASTNode* index = nullptr; - - IndexExpressionNode() { kind = ASTKind::IndexExpression; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "IndexExpression\n"; - if (object) { - std::cout << padRight("", indent + 2) << "Object:\n"; - object->log(indent + 4); - } - if (index) { - std::cout << padRight("", indent + 2) << "Index:\n"; - index->log(indent + 4); - } - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"IndexExpression\""; - if (object) { - ss << ",\n" << in << " \"object\":\n" - << object->toJson(depth + 2); - } - if (index) { - ss << ",\n" << in << " \"index\":\n" - << index->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - -// ============================================================================ -// StructDeclNode — struct Tanımı -// ============================================================================ - - -#endif // SAQUT_AST_EXPR diff --git a/src/parser/ast_stmt.hpp b/src/parser/ast_stmt.hpp deleted file mode 100644 index b60aaf9..0000000 --- a/src/parser/ast_stmt.hpp +++ /dev/null @@ -1,307 +0,0 @@ -// ============================================================================ -// saQut Compiler — AST Deyim Düğümleri -// ============================================================================ -// -// DİZİN: src/parser/ast_stmt.hpp -// İÇERİK: Block, If, While, For, DoWhile, -// Return, Break, Continue, ExpressionStatement -// -// ============================================================================ - -#ifndef SAQUT_AST_STMT -#define SAQUT_AST_STMT - -#include -#include -#include -#include "parser/ast_node.hpp" -#include "parser/ast_json.hpp" -class BlockNode : public ASTNode { -public: - BlockNode() { kind = ASTKind::Block; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "Block\n"; - for (auto* c : getChildren()) c->log(indent + 2); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"Block\",\n" - << in << " \"children\": [\n" - << childrenToJson(this, depth + 3) - << in << " ]\n" - << in << "}"; - return ss.str(); - } -}; - -class IfStatementNode : public ASTNode { -public: - ASTNode* condition = nullptr; - ASTNode* thenBranch = nullptr; - ASTNode* elseBranch = nullptr; - - IfStatementNode() { kind = ASTKind::IfStatement; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "IfStatement\n"; - std::cout << padRight("", indent + 2) << "Condition:\n"; - if (condition) condition->log(indent + 4); - std::cout << padRight("", indent + 2) << "Then:\n"; - if (thenBranch) thenBranch->log(indent + 4); - if (elseBranch) { - std::cout << padRight("", indent + 2) << "Else:\n"; - elseBranch->log(indent + 4); - } - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"IfStatement\""; - if (condition) { - ss << ",\n" << in << " \"condition\":\n" - << condition->toJson(depth + 2); - } - if (thenBranch) { - ss << ",\n" << in << " \"then\":\n" - << thenBranch->toJson(depth + 2); - } - if (elseBranch) { - ss << ",\n" << in << " \"else\":\n" - << elseBranch->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - -class WhileStatementNode : public ASTNode { -public: - ASTNode* condition = nullptr; - ASTNode* body = nullptr; - - WhileStatementNode() { kind = ASTKind::WhileStatement; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "WhileStatement\n"; - std::cout << padRight("", indent + 2) << "Condition:\n"; - if (condition) condition->log(indent + 4); - std::cout << padRight("", indent + 2) << "Body:\n"; - if (body) body->log(indent + 4); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"WhileStatement\""; - if (condition) { - ss << ",\n" << in << " \"condition\":\n" - << condition->toJson(depth + 2); - } - if (body) { - ss << ",\n" << in << " \"body\":\n" - << body->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - -class ForStatementNode : public ASTNode { -public: - ASTNode* init = nullptr; - ASTNode* condition = nullptr; - ASTNode* update = nullptr; - ASTNode* body = nullptr; - - ForStatementNode() { kind = ASTKind::ForStatement; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "ForStatement\n"; - if (init) { - std::cout << padRight("", indent + 2) << "Init:\n"; - init->log(indent + 4); - } - if (condition) { - std::cout << padRight("", indent + 2) << "Condition:\n"; - condition->log(indent + 4); - } - if (update) { - std::cout << padRight("", indent + 2) << "Update:\n"; - update->log(indent + 4); - } - std::cout << padRight("", indent + 2) << "Body:\n"; - if (body) body->log(indent + 4); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"ForStatement\""; - if (init) { - ss << ",\n" << in << " \"init\":\n" - << init->toJson(depth + 2); - } - if (condition) { - ss << ",\n" << in << " \"condition\":\n" - << condition->toJson(depth + 2); - } - if (update) { - ss << ",\n" << in << " \"update\":\n" - << update->toJson(depth + 2); - } - if (body) { - ss << ",\n" << in << " \"body\":\n" - << body->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - -class DoWhileStatementNode : public ASTNode { -public: - ASTNode* condition = nullptr; - ASTNode* body = nullptr; - - DoWhileStatementNode() { kind = ASTKind::DoWhileStatement; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "DoWhileStatement\n"; - std::cout << padRight("", indent + 2) << "Body:\n"; - if (body) body->log(indent + 4); - std::cout << padRight("", indent + 2) << "Condition:\n"; - if (condition) condition->log(indent + 4); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"DoWhileStatement\""; - if (body) { - ss << ",\n" << in << " \"body\":\n" - << body->toJson(depth + 2); - } - if (condition) { - ss << ",\n" << in << " \"condition\":\n" - << condition->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - -// ============================================================================ -// ReturnStatementNode — return [ifade] -// ============================================================================ - -class ReturnStatementNode : public ASTNode { -public: - ASTNode* value = nullptr; - - ReturnStatementNode() { kind = ASTKind::ReturnStatement; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "ReturnStatement"; - if (value) { - std::cout << "\n"; - value->log(indent + 2); - } else { - std::cout << " (void)\n"; - } - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"ReturnStatement\""; - if (value) { - ss << ",\n" << in << " \"value\":\n" - << value->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - -// ============================================================================ -// BreakStatementNode — break -// ============================================================================ - -class BreakStatementNode : public ASTNode { -public: - BreakStatementNode() { kind = ASTKind::BreakStatement; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "BreakStatement\n"; - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - return in + "{\n" + in + " \"kind\": \"BreakStatement\"\n" + in + "}"; - } -}; - -// ============================================================================ -// ContinueStatementNode — continue -// ============================================================================ - -class ContinueStatementNode : public ASTNode { -public: - ContinueStatementNode() { kind = ASTKind::ContinueStatement; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "ContinueStatement\n"; - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - return in + "{\n" + in + " \"kind\": \"ContinueStatement\"\n" + in + "}"; - } -}; - -// ============================================================================ -// ExpressionStatementNode — İfadeyi Statement Olarak Sarma -// ============================================================================ - -class ExpressionStatementNode : public ASTNode { -public: - ASTNode* expression = nullptr; - - ExpressionStatementNode() { kind = ASTKind::ExpressionStatement; } - - void log(int indent = 0) override { - std::cout << padRight("", indent) << "ExpressionStatement\n"; - if (expression) expression->log(indent + 2); - } - - std::string toJson(int depth = 0) override { - std::string in = jsonIndent(depth); - std::ostringstream ss; - ss << in << "{\n" - << in << " \"kind\": \"ExpressionStatement\",\n" - << in << " \"location\": " << loc.toJson() << ""; - if (expression) { - ss << ",\n" << in << " \"expression\":\n" - << expression->toJson(depth + 2); - } - ss << "\n" << in << "}"; - return ss.str(); - } -}; - - -// ============================================================================ -// CallExpressionNode — Fonksiyon Çağrısı f(a, b, ...) -// ============================================================================ - -#endif // SAQUT_AST_STMT diff --git a/src/parser/nodes/binary_expr.cpp b/src/parser/nodes/binary_expr.cpp new file mode 100644 index 0000000..d15731b --- /dev/null +++ b/src/parser/nodes/binary_expr.cpp @@ -0,0 +1,23 @@ +#include "parser/nodes/binary_expr.hpp" +#include "parser/ast_json.hpp" + +BinaryExpressionNode::BinaryExpressionNode() { + kind = ASTKind::BinaryExpression; +} + +void BinaryExpressionNode::log(int indent) { + std::string in = jsonIndent(indent); + std::cout << in << "BinaryExpression (" << (OPERATOR_MAP_REV.count(Operator) ? OPERATOR_MAP_REV.at(Operator) : "?") << ")\n"; + if (Left) Left->log(indent + 1); + if (Right) Right->log(indent + 1); +} + +std::string BinaryExpressionNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "BinaryExpression"); + obj.add("operator", std::string(OPERATOR_MAP_REV.count(Operator) ? OPERATOR_MAP_REV.at(Operator) : "?")); + if (Left) obj.addRaw("left", Left->toJson(depth + 1)); + if (Right) obj.addRaw("right", Right->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} diff --git a/src/parser/nodes/binary_expr.hpp b/src/parser/nodes/binary_expr.hpp new file mode 100644 index 0000000..c760937 --- /dev/null +++ b/src/parser/nodes/binary_expr.hpp @@ -0,0 +1,17 @@ +#ifndef SAQUT_AST_BINARY_EXPR +#define SAQUT_AST_BINARY_EXPR + +#include "parser/ast_node.hpp" + +class BinaryExpressionNode : public ASTNode { +public: + TokenType Operator; + ASTNode* Left = nullptr; + ASTNode* Right = nullptr; + + BinaryExpressionNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +#endif diff --git a/src/parser/nodes/declarations.cpp b/src/parser/nodes/declarations.cpp new file mode 100644 index 0000000..4edc7d2 --- /dev/null +++ b/src/parser/nodes/declarations.cpp @@ -0,0 +1,53 @@ +#include "parser/nodes/declarations.hpp" +#include "parser/ast_json.hpp" + +// FunctionDeclNode +FunctionDeclNode::FunctionDeclNode() { kind = ASTKind::FunctionDecl; } +void FunctionDeclNode::log(int indent) { + std::cout << jsonIndent(indent) << "FunctionDecl (" << name << " : " << returnType << ")\n"; + for (auto* child : children) child->log(indent + 1); +} +std::string FunctionDeclNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "FunctionDecl"); + obj.add("name", name); + obj.add("returnType", returnType); + obj.addArray("children", [&]() { + for (auto* child : children) obj.addItem(child->toJson(depth + 2)); + }); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// VariableDeclNode +VariableDeclNode::VariableDeclNode() { kind = ASTKind::VariableDecl; } +void VariableDeclNode::log(int indent) { + std::cout << jsonIndent(indent) << "VariableDecl (" << name << " : " << varType << ")\n"; + if (initExpr) initExpr->log(indent + 1); +} +std::string VariableDeclNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "VariableDecl"); + obj.add("name", name); + obj.add("varType", varType); + if (initExpr) obj.addRaw("init", initExpr->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// StructDeclNode +StructDeclNode::StructDeclNode() { kind = ASTKind::StructDecl; } +void StructDeclNode::log(int indent) { + std::cout << jsonIndent(indent) << "StructDecl (" << name << ")\n"; + for (auto* child : children) child->log(indent + 1); +} +std::string StructDeclNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "StructDecl"); + obj.add("name", name); + obj.addArray("children", [&]() { + for (auto* child : children) obj.addItem(child->toJson(depth + 2)); + }); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} diff --git a/src/parser/nodes/declarations.hpp b/src/parser/nodes/declarations.hpp new file mode 100644 index 0000000..2638eda --- /dev/null +++ b/src/parser/nodes/declarations.hpp @@ -0,0 +1,33 @@ +#ifndef SAQUT_AST_DECL +#define SAQUT_AST_DECL + +#include "parser/ast_node.hpp" + +class FunctionDeclNode : public ASTNode { +public: + std::string name; + std::string returnType; + FunctionDeclNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class VariableDeclNode : public ASTNode { +public: + std::string varType; + std::string name; + ASTNode* initExpr = nullptr; + VariableDeclNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class StructDeclNode : public ASTNode { +public: + std::string name; + StructDeclNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +#endif diff --git a/src/parser/nodes/expressions.cpp b/src/parser/nodes/expressions.cpp new file mode 100644 index 0000000..5cab82a --- /dev/null +++ b/src/parser/nodes/expressions.cpp @@ -0,0 +1,67 @@ +#include "parser/nodes/expressions.hpp" +#include "parser/ast_json.hpp" + +// PostfixNode +PostfixNode::PostfixNode() { kind = ASTKind::Postfix; } +void PostfixNode::log(int indent) { + std::cout << jsonIndent(indent) << "Postfix (" << (OPERATOR_MAP_REV.count(Operator) ? OPERATOR_MAP_REV.at(Operator) : "?") << ")\n"; + if (operand) operand->log(indent + 1); +} +std::string PostfixNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "Postfix"); + obj.add("operator", std::string(OPERATOR_MAP_REV.count(Operator) ? OPERATOR_MAP_REV.at(Operator) : "?")); + if (operand) obj.addRaw("operand", operand->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// CallExpressionNode +CallExpressionNode::CallExpressionNode() { kind = ASTKind::Call; } +void CallExpressionNode::log(int indent) { + std::cout << jsonIndent(indent) << "Call\n"; + if (callee) callee->log(indent + 1); + for (auto* arg : arguments) arg->log(indent + 1); +} +std::string CallExpressionNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "Call"); + if (callee) obj.addRaw("callee", callee->toJson(depth + 1)); + obj.addArray("arguments", [&]() { + for (auto* arg : arguments) obj.addItem(arg->toJson(depth + 2)); + }); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// MemberAccessNode +MemberAccessNode::MemberAccessNode() { kind = ASTKind::MemberAccess; } +void MemberAccessNode::log(int indent) { + std::cout << jsonIndent(indent) << "MemberAccess (" << (arrow ? "->" : ".") << member << ")\n"; + if (object) object->log(indent + 1); +} +std::string MemberAccessNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "MemberAccess"); + obj.add("member", member); + obj.add("arrow", arrow); + if (object) obj.addRaw("object", object->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// IndexExpressionNode +IndexExpressionNode::IndexExpressionNode() { kind = ASTKind::IndexExpression; } +void IndexExpressionNode::log(int indent) { + std::cout << jsonIndent(indent) << "IndexExpression\n"; + if (object) object->log(indent + 1); + if (index) index->log(indent + 1); +} +std::string IndexExpressionNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "IndexExpression"); + if (object) obj.addRaw("object", object->toJson(depth + 1)); + if (index) obj.addRaw("index", index->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} diff --git a/src/parser/nodes/expressions.hpp b/src/parser/nodes/expressions.hpp new file mode 100644 index 0000000..0efae4f --- /dev/null +++ b/src/parser/nodes/expressions.hpp @@ -0,0 +1,43 @@ +#ifndef SAQUT_AST_EXPR_EXT +#define SAQUT_AST_EXPR_EXT + +#include "parser/ast_node.hpp" + +class PostfixNode : public ASTNode { +public: + ASTNode* operand = nullptr; + TokenType Operator; + PostfixNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class CallExpressionNode : public ASTNode { +public: + ASTNode* callee = nullptr; + std::vector arguments; + CallExpressionNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class MemberAccessNode : public ASTNode { +public: + ASTNode* object = nullptr; + std::string member; + bool arrow = false; + MemberAccessNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class IndexExpressionNode : public ASTNode { +public: + ASTNode* object = nullptr; + ASTNode* index = nullptr; + IndexExpressionNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +#endif diff --git a/src/parser/nodes/identifier.cpp b/src/parser/nodes/identifier.cpp new file mode 100644 index 0000000..57e9a8f --- /dev/null +++ b/src/parser/nodes/identifier.cpp @@ -0,0 +1,23 @@ +#include "parser/nodes/identifier.hpp" +#include +#include +#include "parser/ast_json.hpp" + +IdentifierNode::IdentifierNode() { kind = ASTKind::Identifier; } + +void IdentifierNode::log(int indent) { + std::cout << padRight("", indent) + << "Identifier {" << (parserToken.token ? parserToken.token->token : "?") << "}\n"; +} + +std::string IdentifierNode::toJson(int depth) { + std::string in = jsonIndent(depth); + std::string name = parserToken.token ? parserToken.token->token : "?"; + std::ostringstream ss; + ss << in << "{\n" + << in << " \"kind\": \"Identifier\",\n" + << in << " \"name\": \"" << jsonEscape(name) << "\",\n" + << in << " \"location\": " << loc.toJson() << "\n" + << in << "}"; + return ss.str(); +} diff --git a/src/parser/nodes/identifier.hpp b/src/parser/nodes/identifier.hpp new file mode 100644 index 0000000..f993096 --- /dev/null +++ b/src/parser/nodes/identifier.hpp @@ -0,0 +1,16 @@ +#ifndef SAQUT_AST_IDENTIFIER +#define SAQUT_AST_IDENTIFIER + +#include "parser/ast_node.hpp" + +class IdentifierNode : public ASTNode { +public: + Token* lexerToken = nullptr; + ParserToken parserToken; + + IdentifierNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +#endif diff --git a/src/parser/nodes/literal.cpp b/src/parser/nodes/literal.cpp new file mode 100644 index 0000000..a04b2f4 --- /dev/null +++ b/src/parser/nodes/literal.cpp @@ -0,0 +1,34 @@ +#include "parser/nodes/literal.hpp" +#include +#include +#include "parser/ast_json.hpp" + +LiteralNode::LiteralNode() { kind = ASTKind::Literal; } + +void LiteralNode::log(int indent) { + std::cout << padRight("", indent) + << "Literal {" << (parserToken.token ? parserToken.token->token : "?") << "} " + << literalTypeToString(literalType); + if (literalType == LiteralType::INTEGER && literalBase != 10) + std::cout << " (base " << literalBase << ")"; + std::cout << "\n"; +} + +std::string LiteralNode::toJson(int depth) { + std::string in = jsonIndent(depth); + std::string val = parserToken.token ? parserToken.token->token : "?"; + std::ostringstream ss; + ss << in << "{\n" + << in << " \"kind\": \"Literal\",\n" + << in << " \"literalType\": \"" << literalTypeToString(literalType) << "\",\n" + << in << " \"value\": \"" << jsonEscape(val) << "\""; + if (literalType == LiteralType::INTEGER && literalBase != 10) { + ss << ",\n" << in << " \"base\": " << literalBase; + } + if (literalType == LiteralType::FLOAT) { + ss << ",\n" << in << " \"isFloat\": true"; + } + ss << ",\n" << in << " \"location\": " << loc.toJson() << "\n" + << in << "}"; + return ss.str(); +} diff --git a/src/parser/nodes/literal.hpp b/src/parser/nodes/literal.hpp new file mode 100644 index 0000000..850dc5a --- /dev/null +++ b/src/parser/nodes/literal.hpp @@ -0,0 +1,20 @@ +#ifndef SAQUT_AST_LITERAL +#define SAQUT_AST_LITERAL + +#include "parser/ast_node.hpp" + +class LiteralNode : public ASTNode { +public: + Token* lexerToken = nullptr; + ParserToken parserToken; + + LiteralType literalType = LiteralType::INTEGER; + int literalBase = 10; + bool isFloatValue = false; + + LiteralNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +#endif diff --git a/src/parser/nodes/program.cpp b/src/parser/nodes/program.cpp new file mode 100644 index 0000000..efcce75 --- /dev/null +++ b/src/parser/nodes/program.cpp @@ -0,0 +1,26 @@ +#include "parser/nodes/program.hpp" +#include "parser/ast_json.hpp" + +ProgramNode::ProgramNode() { + kind = ASTKind::Program; +} + +void ProgramNode::log(int indent) { + std::string in = jsonIndent(indent); + std::cout << in << "Program\n"; + for (auto* child : children) { + child->log(indent + 1); + } +} + +std::string ProgramNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "Program"); + obj.addArray("children", [&]() { + for (auto* child : children) { + obj.addItem(child->toJson(depth + 2)); + } + }); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} diff --git a/src/parser/nodes/program.hpp b/src/parser/nodes/program.hpp new file mode 100644 index 0000000..a6face3 --- /dev/null +++ b/src/parser/nodes/program.hpp @@ -0,0 +1,13 @@ +#ifndef SAQUT_AST_PROGRAM +#define SAQUT_AST_PROGRAM + +#include "parser/ast_node.hpp" + +class ProgramNode : public ASTNode { +public: + ProgramNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +#endif diff --git a/src/parser/nodes/statements.cpp b/src/parser/nodes/statements.cpp new file mode 100644 index 0000000..99e2038 --- /dev/null +++ b/src/parser/nodes/statements.cpp @@ -0,0 +1,140 @@ +#include "parser/nodes/statements.hpp" +#include "parser/ast_json.hpp" + +// BlockNode +BlockNode::BlockNode() { kind = ASTKind::Block; } +void BlockNode::log(int indent) { + std::cout << jsonIndent(indent) << "Block\n"; + for (auto* child : children) child->log(indent + 1); +} +std::string BlockNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "Block"); + obj.addArray("children", [&]() { + for (auto* child : children) obj.addItem(child->toJson(depth + 2)); + }); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// IfStatementNode +IfStatementNode::IfStatementNode() { kind = ASTKind::IfStatement; } +void IfStatementNode::log(int indent) { + std::cout << jsonIndent(indent) << "IfStatement\n"; + if (condition) condition->log(indent + 1); + if (thenBranch) thenBranch->log(indent + 1); + if (elseBranch) elseBranch->log(indent + 1); +} +std::string IfStatementNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "IfStatement"); + if (condition) obj.addRaw("condition", condition->toJson(depth + 1)); + if (thenBranch) obj.addRaw("then", thenBranch->toJson(depth + 1)); + if (elseBranch) obj.addRaw("else", elseBranch->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// WhileStatementNode +WhileStatementNode::WhileStatementNode() { kind = ASTKind::WhileStatement; } +void WhileStatementNode::log(int indent) { + std::cout << jsonIndent(indent) << "WhileStatement\n"; + if (condition) condition->log(indent + 1); + if (body) body->log(indent + 1); +} +std::string WhileStatementNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "WhileStatement"); + if (condition) obj.addRaw("condition", condition->toJson(depth + 1)); + if (body) obj.addRaw("body", body->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// ForStatementNode +ForStatementNode::ForStatementNode() { kind = ASTKind::ForStatement; } +void ForStatementNode::log(int indent) { + std::cout << jsonIndent(indent) << "ForStatement\n"; + if (init) init->log(indent + 1); + if (condition) condition->log(indent + 1); + if (update) update->log(indent + 1); + if (body) body->log(indent + 1); +} +std::string ForStatementNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "ForStatement"); + if (init) obj.addRaw("init", init->toJson(depth + 1)); + if (condition) obj.addRaw("condition", condition->toJson(depth + 1)); + if (update) obj.addRaw("update", update->toJson(depth + 1)); + if (body) obj.addRaw("body", body->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// DoWhileStatementNode +DoWhileStatementNode::DoWhileStatementNode() { kind = ASTKind::DoWhileStatement; } +void DoWhileStatementNode::log(int indent) { + std::cout << jsonIndent(indent) << "DoWhileStatement\n"; + if (body) body->log(indent + 1); + if (condition) condition->log(indent + 1); +} +std::string DoWhileStatementNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "DoWhileStatement"); + if (condition) obj.addRaw("condition", condition->toJson(depth + 1)); + if (body) obj.addRaw("body", body->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// ReturnStatementNode +ReturnStatementNode::ReturnStatementNode() { kind = ASTKind::ReturnStatement; } +void ReturnStatementNode::log(int indent) { + std::cout << jsonIndent(indent) << "ReturnStatement\n"; + if (value) value->log(indent + 1); +} +std::string ReturnStatementNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "ReturnStatement"); + if (value) obj.addRaw("value", value->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// BreakStatementNode +BreakStatementNode::BreakStatementNode() { kind = ASTKind::BreakStatement; } +void BreakStatementNode::log(int indent) { + std::cout << jsonIndent(indent) << "BreakStatement\n"; +} +std::string BreakStatementNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "BreakStatement"); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// ContinueStatementNode +ContinueStatementNode::ContinueStatementNode() { kind = ASTKind::ContinueStatement; } +void ContinueStatementNode::log(int indent) { + std::cout << jsonIndent(indent) << "ContinueStatement\n"; +} +std::string ContinueStatementNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "ContinueStatement"); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} + +// ExpressionStatementNode +ExpressionStatementNode::ExpressionStatementNode() { kind = ASTKind::ExpressionStatement; } +void ExpressionStatementNode::log(int indent) { + std::cout << jsonIndent(indent) << "ExpressionStatement\n"; + if (expression) expression->log(indent + 1); +} +std::string ExpressionStatementNode::toJson(int depth) { + JsonObject obj(depth); + obj.add("kind", "ExpressionStatement"); + if (expression) obj.addRaw("expression", expression->toJson(depth + 1)); + obj.addRaw("location", loc.toJson()); + return obj.str(); +} diff --git a/src/parser/nodes/statements.hpp b/src/parser/nodes/statements.hpp new file mode 100644 index 0000000..9ec9662 --- /dev/null +++ b/src/parser/nodes/statements.hpp @@ -0,0 +1,82 @@ +#ifndef SAQUT_AST_STMT +#define SAQUT_AST_STMT + +#include "parser/ast_node.hpp" + +class BlockNode : public ASTNode { +public: + BlockNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class IfStatementNode : public ASTNode { +public: + ASTNode* condition = nullptr; + ASTNode* thenBranch = nullptr; + ASTNode* elseBranch = nullptr; + IfStatementNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class WhileStatementNode : public ASTNode { +public: + ASTNode* condition = nullptr; + ASTNode* body = nullptr; + WhileStatementNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class ForStatementNode : public ASTNode { +public: + ASTNode* init = nullptr; + ASTNode* condition = nullptr; + ASTNode* update = nullptr; + ASTNode* body = nullptr; + ForStatementNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class DoWhileStatementNode : public ASTNode { +public: + ASTNode* condition = nullptr; + ASTNode* body = nullptr; + DoWhileStatementNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class ReturnStatementNode : public ASTNode { +public: + ASTNode* value = nullptr; + ReturnStatementNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class BreakStatementNode : public ASTNode { +public: + BreakStatementNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class ContinueStatementNode : public ASTNode { +public: + ContinueStatementNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +class ExpressionStatementNode : public ASTNode { +public: + ASTNode* expression = nullptr; + ExpressionStatementNode(); + void log(int indent = 0) override; + std::string toJson(int depth = 0) override; +}; + +#endif diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp new file mode 100644 index 0000000..7f0e7e7 --- /dev/null +++ b/src/parser/parser.cpp @@ -0,0 +1,599 @@ +#include "parser/parser.hpp" +#include "parser/nodes/program.hpp" +#include "parser/nodes/binary_expr.hpp" +#include "parser/nodes/literal.hpp" +#include "parser/nodes/identifier.hpp" +#include "parser/nodes/expressions.hpp" +#include "parser/nodes/statements.hpp" +#include "parser/nodes/declarations.hpp" + +// -------------------------------------------------------------------------- +// parseToken: Ham Token'ı ParserToken'a dönüştür. +// -------------------------------------------------------------------------- +ParserToken Parser::parseToken(Token* token) { + ParserToken pt; + pt.token = token; + + std::string t = token->gettype(); + if (t == "string") + pt.type = TokenType::STRING; + else if (t == "number") + pt.type = TokenType::NUMBER; + else if (t == "operator") + pt.type = OPERATOR_MAP.find(pt.token->token)->second; + else if (t == "delimiter") + pt.type = OPERATOR_MAP.find(pt.token->token)->second; + else if (t == "keyword") + pt.type = KEYWORD_MAP.find(pt.token->token)->second; + else if (t == "identifier") + pt.type = TokenType::IDENTIFIER; + + return pt; +} + +ParserToken Parser::getToken(int offset) { + if ((int)tokens.size() - 1 < current + offset) { + ParserToken pt; + pt.type = TokenType::SVR_VOID; + return pt; + } + return parseToken(tokens[current + offset]); +} + +void Parser::nextToken() { + if ((int)tokens.size() >= current + 1) + current++; +} + +ParserToken Parser::lookahead(uint32_t forward) { + return getToken(forward); +} + +ParserToken Parser::currentToken() { + return getToken(0); +} + +ASTNode* Parser::parse(TokenList toks) { + tokens = toks; + current = 0; + return parseProgram(); +} + +ASTNode* Parser::parseProgram() { + ProgramNode* program = new ProgramNode(); + + while (currentToken().type != TokenType::SVR_VOID) { + ASTNode* decl = parseDeclaration(); + if (decl) + program->addChild(decl); + else + break; + } + + return program; +} + +ASTNode* Parser::parseDeclaration() { + auto ct = currentToken(); + + if (ct.is({ + TokenType::KW_VOID, TokenType::KW_INT, TokenType::KW_FLOAT_TYPE, + TokenType::KW_DOUBLE, TokenType::KW_BOOL, TokenType::KW_CHAR, + TokenType::KW_STRING_TYPE, TokenType::KW_AUTO + })) { + auto la1 = lookahead(1); + auto la2 = lookahead(2); + if (la1.type == TokenType::IDENTIFIER && la2.type == TokenType::LPAREN) + return parseFunctionDecl(); + return parseVariableDecl(); + } + + if (ct.type == TokenType::KW_STRUCT) + return parseStructDecl(); + + return parseStatement(); +} + +ASTNode* Parser::parseExpression() { + return parseExpression(0); +} + +ASTNode* Parser::parseExpression(uint16_t precedence) { + if (currentToken().type == TokenType::SVR_VOID) + return nullptr; + + ASTNode* left = parseNullDenotation(); + if (!left) return nullptr; + + while (true) { + auto next = currentToken(); + if (next.type == TokenType::RPAREN || + next.type == TokenType::SEMICOLON || + next.type == TokenType::RBRACE || + next.type == TokenType::COMMA) + break; + + if (precedence < next.getPowerOperator()) { + left = parseLeftDenotation(left); + } else { + break; + } + } + return left; +} + +ASTNode* Parser::parseNullDenotation() { + auto ct = currentToken(); + + if (ct.type == TokenType::SVR_VOID) { + std::cerr << "Parser hatası: beklenmeyen dosya sonu\n"; + return nullptr; + } + + if (ct.type == TokenType::LPAREN) { + nextToken(); + ASTNode* expr = parseExpression(0); + if (currentToken().type == TokenType::RPAREN) + nextToken(); + return expr; + } + + if (ct.is({ + TokenType::PLUS_PLUS, TokenType::MINUS_MINUS, + TokenType::PLUS, TokenType::MINUS, + TokenType::BANG, TokenType::TILDE + })) { + nextToken(); + ASTNode* right = parseExpression(ct.getPowerOperator()); + BinaryExpressionNode* bin = new BinaryExpressionNode(); + bin->loc = ct.token ? ct.token->loc : SourceLocation{}; + bin->Right = right; + bin->Left = nullptr; + bin->Operator = ct.type; + if (right) right->parent = bin; + return bin; + } + + if (ct.type == TokenType::NUMBER) { + nextToken(); + LiteralNode* lit = new LiteralNode(); + lit->loc = ct.token ? ct.token->loc : SourceLocation{}; + lit->lexerToken = ct.token; + lit->parserToken = ct; + if (auto* nt = dynamic_cast(ct.token)) { + lit->literalBase = nt->base; + lit->isFloatValue = nt->isFloat; + lit->literalType = nt->isFloat ? LiteralType::FLOAT : LiteralType::INTEGER; + } + return lit; + } + + if (ct.type == TokenType::STRING) { + nextToken(); + LiteralNode* lit = new LiteralNode(); + lit->literalType = LiteralType::STRING; + lit->loc = ct.token ? ct.token->loc : SourceLocation{}; + lit->lexerToken = ct.token; + lit->parserToken = ct; + return lit; + } + + if (ct.is({TokenType::KW_TRUE, TokenType::KW_FALSE, TokenType::KW_NULL})) { + nextToken(); + LiteralNode* lit = new LiteralNode(); + if (ct.is({TokenType::KW_TRUE, TokenType::KW_FALSE})) + lit->literalType = LiteralType::BOOLEAN; + else + lit->literalType = LiteralType::BOŞ; + lit->loc = ct.token ? ct.token->loc : SourceLocation{}; + lit->lexerToken = ct.token; + lit->parserToken = ct; + return lit; + } + + if (ct.type == TokenType::IDENTIFIER) { + nextToken(); + IdentifierNode* id = new IdentifierNode(); + id->loc = ct.token ? ct.token->loc : SourceLocation{}; + id->lexerToken = ct.token; + id->parserToken = ct; + return id; + } + + return nullptr; +} + +ASTNode* Parser::parseLeftDenotation(ASTNode* left) { + auto ct = currentToken(); + + if (ct.is({TokenType::PLUS_PLUS, TokenType::MINUS_MINUS})) { + nextToken(); + PostfixNode* pf = new PostfixNode(); + pf->loc = ct.token ? ct.token->loc : SourceLocation{}; + pf->operand = left; + pf->Operator = ct.type; + left->parent = pf; + return pf; + } + + if (ct.type == TokenType::LPAREN) { + nextToken(); + CallExpressionNode* call = new CallExpressionNode(); + call->loc = ct.token ? ct.token->loc : SourceLocation{}; + call->callee = left; + left->parent = call; + + if (currentToken().type != TokenType::RPAREN) { + call->arguments.push_back(parseExpression(0)); + while (currentToken().type == TokenType::COMMA) { + nextToken(); + call->arguments.push_back(parseExpression(0)); + } + } + if (currentToken().type == TokenType::RPAREN) + nextToken(); + return call; + } + + if (ct.type == TokenType::LBRACKET) { + nextToken(); + IndexExpressionNode* idx = new IndexExpressionNode(); + idx->loc = ct.token ? ct.token->loc : SourceLocation{}; + idx->object = left; + left->parent = idx; + idx->index = parseExpression(0); + if (currentToken().type == TokenType::RBRACKET) + nextToken(); + return idx; + } + + if (ct.type == TokenType::DOT || ct.type == TokenType::ARROW) { + bool arrow = (ct.type == TokenType::ARROW); + nextToken(); + + if (currentToken().type != TokenType::IDENTIFIER) { + std::cerr << "Parser hatasi: uye ismi bekleniyor\n"; + return left; + } + + MemberAccessNode* ma = new MemberAccessNode(); + ma->loc = ct.token ? ct.token->loc : SourceLocation{}; + ma->object = left; + ma->member = currentToken().token->token; + ma->arrow = arrow; + left->parent = ma; + nextToken(); + return ma; + } + + uint16_t prec = ct.getPowerOperator(); + nextToken(); + + ASTNode* right = parseExpression(prec); + + BinaryExpressionNode* bin = new BinaryExpressionNode(); + bin->loc = ct.token ? ct.token->loc : SourceLocation{}; + bin->Left = left; + bin->Right = right; + bin->Operator = ct.type; + if (left) left->parent = bin; + if (right) right->parent = bin; + return bin; +} + +ASTNode* Parser::parseFunctionDecl() { + FunctionDeclNode* fn = new FunctionDeclNode(); + fn->loc = currentToken().token->loc; + fn->returnType = currentToken().token->token; + nextToken(); + + fn->name = currentToken().token->token; + nextToken(); + + if (currentToken().type == TokenType::LPAREN) { + nextToken(); + while (currentToken().type != TokenType::RPAREN && + currentToken().type != TokenType::SVR_VOID) + nextToken(); + if (currentToken().type == TokenType::RPAREN) + nextToken(); + } + + if (currentToken().type == TokenType::LBRACE) { + ASTNode* body = parseBlock(); + fn->addChild(body); + } + + return fn; +} + +ASTNode* Parser::parseStructDecl() { + StructDeclNode* st = new StructDeclNode(); + st->loc = currentToken().token->loc; + nextToken(); + if (currentToken().type == TokenType::IDENTIFIER) { + st->name = currentToken().token->token; + nextToken(); + } + if (currentToken().type == TokenType::LBRACE) { + nextToken(); + while (currentToken().type != TokenType::RBRACE && currentToken().type != TokenType::SVR_VOID) { + ASTNode* field = parseDeclaration(); + if (field) st->addChild(field); + else break; + } + if (currentToken().type == TokenType::RBRACE) nextToken(); + } + if (currentToken().type == TokenType::SEMICOLON) nextToken(); + return st; +} + +ASTNode* Parser::parseVariableDecl() { + VariableDeclNode* vd = new VariableDeclNode(); + vd->loc = currentToken().token->loc; + vd->varType = currentToken().token->token; + nextToken(); + + if (currentToken().type != TokenType::IDENTIFIER) { + std::cerr << "Parser hatası: değişken ismi bekleniyor\n"; + return vd; + } + + vd->name = currentToken().token->token; + nextToken(); + + if (currentToken().type == TokenType::LBRACKET) { + nextToken(); + while (currentToken().type != TokenType::RBRACKET && + currentToken().type != TokenType::SEMICOLON && + currentToken().type != TokenType::SVR_VOID) + nextToken(); + if (currentToken().type == TokenType::RBRACKET) + nextToken(); + } + + if (currentToken().type == TokenType::EQUAL) { + nextToken(); + vd->initExpr = parseExpression(); + } + + while (currentToken().type == TokenType::COMMA) { + nextToken(); + + if (currentToken().type != TokenType::IDENTIFIER) { + std::cerr << "Parser hatası: virgülden sonra değişken ismi bekleniyor\n"; + break; + } + + VariableDeclNode* sibling = new VariableDeclNode(); + sibling->loc = currentToken().token->loc; + sibling->varType = vd->varType; + sibling->name = currentToken().token->token; + nextToken(); + + if (currentToken().type == TokenType::LBRACKET) { + nextToken(); + while (currentToken().type != TokenType::RBRACKET && + currentToken().type != TokenType::SEMICOLON && + currentToken().type != TokenType::SVR_VOID) + nextToken(); + if (currentToken().type == TokenType::RBRACKET) + nextToken(); + } + + if (currentToken().type == TokenType::EQUAL) { + nextToken(); + sibling->initExpr = parseExpression(); + } + + vd->addChild(sibling); + } + + if (currentToken().type == TokenType::SEMICOLON) + nextToken(); + + return vd; +} + +ASTNode* Parser::parseStatement() { + auto ct = currentToken(); + + if (ct.type == TokenType::LBRACE) + return parseBlock(); + + if (ct.type == TokenType::KW_IF) + return parseIfStatement(); + + if (ct.type == TokenType::KW_WHILE) + return parseWhileStatement(); + + if (ct.type == TokenType::KW_FOR) + return parseForStatement(); + + if (ct.type == TokenType::KW_DO) + return parseDoWhileStatement(); + + if (ct.type == TokenType::KW_RETURN) + return parseReturnStatement(); + + if (ct.type == TokenType::KW_BREAK) + return parseBreakStatement(); + + if (ct.type == TokenType::KW_CONTINUE) + return parseContinueStatement(); + + if (ct.is({ + TokenType::KW_VOID, TokenType::KW_INT, TokenType::KW_FLOAT_TYPE, + TokenType::KW_DOUBLE, TokenType::KW_BOOL, TokenType::KW_CHAR, + TokenType::KW_STRING_TYPE + })) { + return parseVariableDecl(); + } + + if (ct.type == TokenType::KW_STRUCT) + return parseStructDecl(); + + return parseExpressionStatement(); +} + +ASTNode* Parser::parseBlock() { + BlockNode* block = new BlockNode(); + block->loc = currentToken().token ? currentToken().token->loc : SourceLocation{}; + + if (currentToken().type == TokenType::LBRACE) + nextToken(); + + while (currentToken().type != TokenType::RBRACE && + currentToken().type != TokenType::SVR_VOID) { + ASTNode* stmt = parseStatement(); + if (stmt) + block->addChild(stmt); + else + break; + } + + if (currentToken().type == TokenType::RBRACE) + nextToken(); + + return block; +} + +ASTNode* Parser::parseIfStatement() { + IfStatementNode* ifNode = new IfStatementNode(); + ifNode->loc = currentToken().token->loc; + nextToken(); + + if (currentToken().type == TokenType::LPAREN) { + nextToken(); + ifNode->condition = parseExpression(); + if (currentToken().type == TokenType::RPAREN) + nextToken(); + } + + ifNode->thenBranch = parseStatement(); + + if (currentToken().type == TokenType::KW_ELSE) { + nextToken(); + ifNode->elseBranch = parseStatement(); + } + + return ifNode; +} + +ASTNode* Parser::parseWhileStatement() { + WhileStatementNode* ws = new WhileStatementNode(); + ws->loc = currentToken().token->loc; + nextToken(); + + if (currentToken().type == TokenType::LPAREN) { + nextToken(); + ws->condition = parseExpression(); + if (currentToken().type == TokenType::RPAREN) + nextToken(); + } + + ws->body = parseStatement(); + return ws; +} + +ASTNode* Parser::parseForStatement() { + ForStatementNode* fs = new ForStatementNode(); + fs->loc = currentToken().token->loc; + nextToken(); + + if (currentToken().type == TokenType::LPAREN) + nextToken(); + + if (currentToken().type != TokenType::SEMICOLON) + fs->init = parseStatement(); + if (currentToken().type == TokenType::SEMICOLON) + nextToken(); + + if (currentToken().type != TokenType::SEMICOLON) + fs->condition = parseExpression(); + if (currentToken().type == TokenType::SEMICOLON) + nextToken(); + + if (currentToken().type != TokenType::RPAREN) + fs->update = parseExpression(); + if (currentToken().type == TokenType::RPAREN) + nextToken(); + + fs->body = parseStatement(); + + return fs; +} + +ASTNode* Parser::parseDoWhileStatement() { + DoWhileStatementNode* dw = new DoWhileStatementNode(); + dw->loc = currentToken().token->loc; + nextToken(); + + dw->body = parseStatement(); + + if (currentToken().type == TokenType::KW_WHILE) { + nextToken(); + if (currentToken().type == TokenType::LPAREN) { + nextToken(); + dw->condition = parseExpression(); + if (currentToken().type == TokenType::RPAREN) + nextToken(); + } + if (currentToken().type == TokenType::SEMICOLON) + nextToken(); + } + + return dw; +} + +ASTNode* Parser::parseReturnStatement() { + ReturnStatementNode* rs = new ReturnStatementNode(); + rs->loc = currentToken().token->loc; + nextToken(); + + if (currentToken().type != TokenType::SEMICOLON && + currentToken().type != TokenType::RBRACE) { + rs->value = parseExpression(); + } + + if (currentToken().type == TokenType::SEMICOLON) + nextToken(); + + return rs; +} + +ASTNode* Parser::parseBreakStatement() { + BreakStatementNode* bs = new BreakStatementNode(); + bs->loc = currentToken().token->loc; + nextToken(); + if (currentToken().type == TokenType::SEMICOLON) + nextToken(); + return bs; +} + +ASTNode* Parser::parseContinueStatement() { + ContinueStatementNode* cs = new ContinueStatementNode(); + cs->loc = currentToken().token->loc; + nextToken(); + if (currentToken().type == TokenType::SEMICOLON) + nextToken(); + return cs; +} + +ASTNode* Parser::parseExpressionStatement() { + ExpressionStatementNode* es = new ExpressionStatementNode(); + es->loc = currentToken().token ? currentToken().token->loc : SourceLocation{}; + es->expression = parseExpression(); + if (!es->expression) { + while (currentToken().type != TokenType::SEMICOLON && + currentToken().type != TokenType::RBRACE && + currentToken().type != TokenType::SVR_VOID) + nextToken(); + if (currentToken().type == TokenType::SEMICOLON) + nextToken(); + } + if (currentToken().type == TokenType::SEMICOLON) + nextToken(); + + return es; +} diff --git a/src/parser/parser.hpp b/src/parser/parser.hpp index 4dddae4..f0cbb9a 100644 --- a/src/parser/parser.hpp +++ b/src/parser/parser.hpp @@ -1,32 +1,6 @@ -// ============================================================================ -// saQut Compiler — Parser (Aggregator) -// ============================================================================ -// -// DİZİN: src/parser/parser.hpp -// KATMAN: Katman 3 — Tokenizer'ı tüketir, AST üretir -// -// Bu dosya bir AGGREGATOR'dür. Parser'ın tüm bileşenlerini tek bir include -// ile kullanılabilir yapar. -// -// MİMARİ: -// parser_base.hpp — Parser sınıf tanımı -// parser_core.hpp — parse, parseProgram, parseDeclaration, parseExpression -// parser_decl.hpp — parseFunctionDecl, parseStructDecl, parseVariableDecl -// parser_stmt.hpp — parseStatement, parseBlock, parseIf/While/For/... -// -// İKİ AYRI PARSER STRATEJİSİ: -// 1. Pratt Parser (ifadeler için): Operatör önceliğini merkezi tabloda yönetir -// 2. Recursive Descent (statement/deklarasyon): Her yapı kendi parse fonksiyonuna sahip -// -// ============================================================================ - #ifndef SAQUT_PARSER #define SAQUT_PARSER -// Sıralama önemli: önce sınıf tanımı, sonra metot gövdeleri #include "parser/parser_base.hpp" -#include "parser/parser_core.hpp" -#include "parser/parser_decl.hpp" -#include "parser/parser_stmt.hpp" #endif // SAQUT_PARSER diff --git a/src/parser/parser_core.hpp b/src/parser/parser_core.hpp deleted file mode 100644 index f6e73ec..0000000 --- a/src/parser/parser_core.hpp +++ /dev/null @@ -1,409 +0,0 @@ -// ============================================================================ -// saQut Compiler — Parser Çekirdek (Program + İfadeler) -// ============================================================================ -// -// DİZİN: src/parser/parser_core.hpp -// İÇERİK: Token navigasyonu, parse(), parseProgram(), -// parseDeclaration(), parseExpression() [Pratt] -// -// ============================================================================ - -#ifndef SAQUT_PARSER_CORE -#define SAQUT_PARSER_CORE - -#include -#include "parser/parser_base.hpp" -// -------------------------------------------------------------------------- -// parseToken: Ham Token'ı ParserToken'a dönüştür. -// -// Tokenizer'ın string tabanlı tip sistemini ("number", "operator", ...) -// Parser'ın anlamsal tip sistemine (NUMBER, PLUS, KW_IF, ...) çevirir. -// -// BUG FIX (commit 40579ca): pt.token = token (pointer ataması). -// Eskiden pt.token = *token (değer kopyası) object slicing yapıyordu. -// -------------------------------------------------------------------------- -inline ParserToken Parser::parseToken(Token* token) { - ParserToken pt; - pt.token = token; // Pointer — değer kopyası DEĞİL - - std::string t = token->gettype(); - if (t == "string") - pt.type = TokenType::STRING; - else if (t == "number") - pt.type = TokenType::NUMBER; - else if (t == "operator") - pt.type = OPERATOR_MAP.find(pt.token->token)->second; - else if (t == "delimiter") - pt.type = OPERATOR_MAP.find(pt.token->token)->second; - else if (t == "keyword") - pt.type = KEYWORD_MAP.find(pt.token->token)->second; - else if (t == "identifier") - pt.type = TokenType::IDENTIFIER; - - return pt; -} - -// -------------------------------------------------------------------------- -// getToken: Güvenli token erişimi. Sınır dışı = SVR_VOID. -// -------------------------------------------------------------------------- -inline ParserToken Parser::getToken(int offset) { - if ((int)tokens.size() - 1 < current + offset) { - ParserToken pt; - pt.type = TokenType::SVR_VOID; - return pt; - } - return parseToken(tokens[current + offset]); -} - -inline void Parser::nextToken() { - if ((int)tokens.size() >= current + 1) - current++; -} - -inline ParserToken Parser::lookahead(uint32_t forward) { - return getToken(forward); -} - -inline ParserToken Parser::currentToken() { - return getToken(0); -} - -// ============================================================================ -// Üst Seviye -// ============================================================================ - -// -------------------------------------------------------------------------- -// parse: Parser'ın ana giriş noktası. Token listesini alır, AST döndürür. -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parse(TokenList toks) { - tokens = toks; - current = 0; - return parseProgram(); -} - -// -------------------------------------------------------------------------- -// parseProgram: Tüm üst seviye deklarasyonları/statement'ları ayrıştırır. -// -// Program ::= Declaration* -// EOF'a (SVR_VOID) kadar parseDeclaration() çağrılır. -// -// BUG FIX (commit 438bc0e): Eskiden parseExpression() doğrudan çağrılıyordu, -// bu sadece tek bir ifadeyi ayrıştırabiliyordu. Şimdi tam program desteği var. -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseProgram() { - ProgramNode* program = new ProgramNode(); - - while (currentToken().type != TokenType::SVR_VOID) { - ASTNode* decl = parseDeclaration(); - if (decl) - program->addChild(decl); - else - break; // Hata durumunda döngüden çık - } - - return program; -} - -// ============================================================================ -// Deklarasyonlar -// ============================================================================ - -// -------------------------------------------------------------------------- -// parseDeclaration: Üst seviye deklarasyon ayrıştırıcı. -// -// Strateji: -// 1. Mevcut token bir tip keyword'ü mü (int, void, float, ...)? -// - Evet → lookahead(2) '(' ise → fonksiyon tanımı -// - Evet → değilse → değişken tanımı -// 2. Değilse → statement (REPL modunda ifade de olabilir) -// -// LOOKAHEAD KULLANIMI: -// "int main()" ve "int x = 10" ayrımı için 2 ileriye bakarız: -// - int main() → lookahead(1)=identifier, lookahead(2)='(' -// - int x = 10 → lookahead(1)=identifier, lookahead(2)='=' -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseDeclaration() { - auto ct = currentToken(); - - // Tip keyword'ü ile başlayan → fonksiyon veya değişken - if (ct.is({ - TokenType::KW_VOID, TokenType::KW_INT, TokenType::KW_FLOAT_TYPE, - TokenType::KW_DOUBLE, TokenType::KW_BOOL, TokenType::KW_CHAR, - TokenType::KW_STRING_TYPE, TokenType::KW_AUTO - })) { - auto la1 = lookahead(1); - auto la2 = lookahead(2); - // int main( ... ) → fonksiyon - if (la1.type == TokenType::IDENTIFIER && la2.type == TokenType::LPAREN) - return parseFunctionDecl(); - // int x ... → değişken - return parseVariableDecl(); - } - - // struct - if (ct.type == TokenType::KW_STRUCT) - return parseStructDecl(); - - // Tip keyword'ü değil → statement - return parseStatement(); -} - -// -------------------------------------------------------------------------- -// parseFunctionDecl: Fonksiyon tanımı. - -inline ASTNode* Parser::parseExpression() { - return parseExpression(0); -} - -// -------------------------------------------------------------------------- -// parseExpression(precedence): Pratt'ın ana döngüsü. -// -// Algoritma: -// 1. NUD ile ilk operand'ı ayrıştır (prefix) -// 2. Mevcut token bir operatör mü? -// - Evet ve önceliği > precedence ise → LED ile infix ayrıştır -// - Hayır veya öncelik <= precedence ise → dur, sol operand'ı döndür -// 3. LED'in döndürdüğü düğüm yeni sol operand olur, 2. adıma dön -// -// DURMA KOŞULLARI: -// - RPAREN, SEMICOLON, RBRACE, COMMA: İfade sonu sinyali -// - Operatörün önceliği <= mevcut öncelik: Daha sıkı bağlanamaz -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseExpression(uint16_t precedence) { - if (currentToken().type == TokenType::SVR_VOID) - return nullptr; - - // 1. Prefix (NUD) - ASTNode* left = parseNullDenotation(); - if (!left) return nullptr; - - // 2. Infix/Postfix döngüsü (LED) - while (true) { - auto next = currentToken(); - - // İfade sonu sinyalleri → dur - if (next.type == TokenType::RPAREN || - next.type == TokenType::SEMICOLON || - next.type == TokenType::RBRACE || - next.type == TokenType::COMMA) - break; - - // Operatörün bağlanma gücü yetersiz → dur - // (daha yüksek öncelikli bir bağlamdayız, bu operatör oraya ait değil) - if (precedence < next.getPowerOperator()) { - left = parseLeftDenotation(left); - } else { - break; - } - } - return left; -} - -// -------------------------------------------------------------------------- -// parseNullDenotation (NUD): Prefix ifadeleri. -// -// İşlenen prefix tipleri: -// - Parantez: ( expression ) -// - Unary: +expr, -expr, !expr, ~expr, ++expr, --expr -// - Literal: 42, "hello", true, false, null -// - Identifier: x, myVar -// -// DÖNÜŞ: Ayrıştırılmış AST düğümü. Token TÜKETİLMİŞ olur (current ilerlemiş). -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseNullDenotation() { - auto ct = currentToken(); - - if (ct.type == TokenType::SVR_VOID) { - std::cerr << "Parser hatası: beklenmeyen dosya sonu\n"; - return nullptr; - } - - // --- Parantezli ifade: ( expr ) --- - // Önceliği sıfırlar — parantez içinde yeni bir ifade başlar. - if (ct.type == TokenType::LPAREN) { - nextToken(); // '(' tüket - ASTNode* expr = parseExpression(0); // Öncelik sıfırla - if (currentToken().type == TokenType::RPAREN) - nextToken(); // ')' tüket - return expr; - } - - // --- Unary prefix operatörler: +, -, !, ~, ++, -- --- - // PLUS ve MINUS burada UNARY olarak işlenir. - // Binary olarak işlenmesi LED tarafından yapılır. - // - // ÖNEMLİ: PLUS ve MINUS için getPowerOperator() 13 döndürür (binary öncelik). - // Ama burada unary olarak kullanılıyor. parseExpression(16) çağırmak daha - // doğru olurdu ancak mevcut çalışma şekli de doğru sonuç veriyor. - // TODO: Unary için ayrı öncelik seviyesi (örn: 16) - if (ct.is({ - TokenType::PLUS_PLUS, TokenType::MINUS_MINUS, - TokenType::PLUS, TokenType::MINUS, - TokenType::BANG, TokenType::TILDE - })) { - nextToken(); // Operatörü tüket - // Sağ operand'ı ayrıştır. Unary prefix sağdan sola bağlanır. - ASTNode* right = parseExpression(ct.getPowerOperator()); - BinaryExpressionNode* bin = new BinaryExpressionNode(); - bin->loc = ct.token ? ct.token->loc : SourceLocation{}; - bin->Right = right; - bin->Left = nullptr; // Unary işaretçisi - bin->Operator = ct.type; - if (right) right->parent = bin; - return bin; - } - - // --- Sayısal literal: 42, 0xFF, 3.14 --- - if (ct.type == TokenType::NUMBER) { - nextToken(); // Token'ı tüket - LiteralNode* lit = new LiteralNode(); - lit->loc = ct.token ? ct.token->loc : SourceLocation{}; - lit->lexerToken = ct.token; - lit->parserToken = ct; - // NumberToken'a cast edip base/isFloat bilgisini al - if (auto* nt = dynamic_cast(ct.token)) { - lit->literalBase = nt->base; - lit->isFloatValue = nt->isFloat; - lit->literalType = nt->isFloat ? LiteralType::FLOAT : LiteralType::INTEGER; - } - return lit; - } - - // --- String literal: "hello" --- - if (ct.type == TokenType::STRING) { - nextToken(); - LiteralNode* lit = new LiteralNode(); - lit->literalType = LiteralType::STRING; - lit->loc = ct.token ? ct.token->loc : SourceLocation{}; - lit->lexerToken = ct.token; - lit->parserToken = ct; - return lit; - } - - // --- Boolean/null literal: true, false, null --- - if (ct.is({TokenType::KW_TRUE, TokenType::KW_FALSE, TokenType::KW_NULL})) { - nextToken(); - LiteralNode* lit = new LiteralNode(); - // Token içeriğine göre boolean/null ayrımı - if (ct.is({TokenType::KW_TRUE, TokenType::KW_FALSE})) - lit->literalType = LiteralType::BOOLEAN; - else - lit->literalType = LiteralType::BOŞ; - lit->loc = ct.token ? ct.token->loc : SourceLocation{}; - lit->lexerToken = ct.token; - lit->parserToken = ct; - return lit; - } - - // --- Identifier: x, myVar --- - if (ct.type == TokenType::IDENTIFIER) { - nextToken(); - IdentifierNode* id = new IdentifierNode(); - id->loc = ct.token ? ct.token->loc : SourceLocation{}; - id->lexerToken = ct.token; - id->parserToken = ct; - return id; - } - - return nullptr; -} - -// -------------------------------------------------------------------------- -// parseLeftDenotation (LED): Infix ve Postfix ifadeler. -// -// Sol operand zaten ayrıştırılmış olarak gelir (left). -// Mevcut token operatördür. -// -// İşlenen tipler: -// - Postfix: expr++, expr-- -// - Binary infix: expr + expr, expr * expr, expr == expr, ... -// -// TASARIM NOTU: Postfix ve Binary aynı fonksiyonda işlenir çünkü ikisi de -// "sol operand + operatör" pattern'ini takip eder. Postfix'te sağ operand -// yoktur. -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseLeftDenotation(ASTNode* left) { - auto ct = currentToken(); - - // --- Postfix: expr++, expr-- --- - if (ct.is({TokenType::PLUS_PLUS, TokenType::MINUS_MINUS})) { - nextToken(); - PostfixNode* pf = new PostfixNode(); - pf->loc = ct.token ? ct.token->loc : SourceLocation{}; - pf->operand = left; - pf->Operator = ct.type; - left->parent = pf; - return pf; - } - - // --- Fonksiyon cagrisi: expr(args) --- - if (ct.type == TokenType::LPAREN) { - nextToken(); - CallExpressionNode* call = new CallExpressionNode(); - call->loc = ct.token ? ct.token->loc : SourceLocation{}; - call->callee = left; - left->parent = call; - - if (currentToken().type != TokenType::RPAREN) { - call->arguments.push_back(parseExpression(0)); - while (currentToken().type == TokenType::COMMA) { - nextToken(); - call->arguments.push_back(parseExpression(0)); - } - } - if (currentToken().type == TokenType::RPAREN) - nextToken(); - return call; - } - - // --- Dizi erisimi: expr[index] --- - if (ct.type == TokenType::LBRACKET) { - nextToken(); - IndexExpressionNode* idx = new IndexExpressionNode(); - idx->loc = ct.token ? ct.token->loc : SourceLocation{}; - idx->object = left; - left->parent = idx; - idx->index = parseExpression(0); - if (currentToken().type == TokenType::RBRACKET) - nextToken(); - return idx; - } - - // --- Uye erisimi: expr.member / expr->member --- - if (ct.type == TokenType::DOT || ct.type == TokenType::ARROW) { - bool arrow = (ct.type == TokenType::ARROW); - nextToken(); - - if (currentToken().type != TokenType::IDENTIFIER) { - std::cerr << "Parser hatasi: uye ismi bekleniyor\n"; - return left; - } - - MemberAccessNode* ma = new MemberAccessNode(); - ma->loc = ct.token ? ct.token->loc : SourceLocation{}; - ma->object = left; - ma->member = currentToken().token->token; - ma->arrow = arrow; - left->parent = ma; - nextToken(); - return ma; - } - - // --- Binary infix: expr OP expr --- - uint16_t prec = ct.getPowerOperator(); - nextToken(); - - ASTNode* right = parseExpression(prec); - - BinaryExpressionNode* bin = new BinaryExpressionNode(); - bin->loc = ct.token ? ct.token->loc : SourceLocation{}; - bin->Left = left; - bin->Right = right; - bin->Operator = ct.type; - if (left) left->parent = bin; - if (right) right->parent = bin; - return bin; -} - - -#endif // SAQUT_PARSER_CORE diff --git a/src/parser/parser_decl.hpp b/src/parser/parser_decl.hpp deleted file mode 100644 index 071da47..0000000 --- a/src/parser/parser_decl.hpp +++ /dev/null @@ -1,159 +0,0 @@ -// ============================================================================ -// saQut Compiler — Parser Deklarasyonlar -// ============================================================================ -// -// DİZİN: src/parser/parser_decl.hpp -// İÇERİK: parseFunctionDecl(), parseStructDecl(), parseVariableDecl() -// -// ============================================================================ - -#ifndef SAQUT_PARSER_DECL -#define SAQUT_PARSER_DECL - -#include -#include "parser/parser_base.hpp" -inline ASTNode* Parser::parseFunctionDecl() { - FunctionDeclNode* fn = new FunctionDeclNode(); - fn->loc = currentToken().token->loc; - fn->returnType = currentToken().token->token; // "int", "void", ... - nextToken(); // Dönüş tipini tüket - - fn->name = currentToken().token->token; // "main", "calculate", ... - nextToken(); // İsmi tüket - - // Parametre listesi: ( ... ) - if (currentToken().type == TokenType::LPAREN) { - nextToken(); // '(' tüket - // TODO: Parametreleri ayrıştır - // Şimdilik ')' gelene kadar atla - while (currentToken().type != TokenType::RPAREN && - currentToken().type != TokenType::SVR_VOID) - nextToken(); - if (currentToken().type == TokenType::RPAREN) - nextToken(); // ')' tüket - } - - // Gövde: { ... } - if (currentToken().type == TokenType::LBRACE) { - ASTNode* body = parseBlock(); - fn->addChild(body); - } - - return fn; -} -// -------------------------------------------------------------------------- -// parseStructDecl: struct tanimi. -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseStructDecl() { - StructDeclNode* st = new StructDeclNode(); - st->loc = currentToken().token->loc; - nextToken(); - if (currentToken().type == TokenType::IDENTIFIER) { - st->name = currentToken().token->token; - nextToken(); - } - if (currentToken().type == TokenType::LBRACE) { - nextToken(); - while (currentToken().type != TokenType::RBRACE && currentToken().type != TokenType::SVR_VOID) { - ASTNode* field = parseDeclaration(); - if (field) st->addChild(field); - else break; - } - if (currentToken().type == TokenType::RBRACE) nextToken(); - } - if (currentToken().type == TokenType::SEMICOLON) nextToken(); - return st; -} - - -// -------------------------------------------------------------------------- -// parseVariableDecl: Değişken tanımı. -// -// Sözdizimi: Type Identifier [= Expression] {, Identifier [= Expression]} ; -// Örnek: int x = 10; -// float y; (initExpr = nullptr) -// int first = 0, second = 1, next; -// -// Çoklu değişken: -// İlk değişken ana düğüm olur. Virgülle ayrılmış ek değişkenler -// ana düğümün children vektörüne eklenir. JSON çıktısında "declarators" -// dizisi olarak görünür. -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseVariableDecl() { - // --- Tip ve ilk değişken adı --- - VariableDeclNode* vd = new VariableDeclNode(); - vd->loc = currentToken().token->loc; - vd->varType = currentToken().token->token; // "int", "float", ... - nextToken(); // Tipi tüket - - if (currentToken().type != TokenType::IDENTIFIER) { - std::cerr << "Parser hatası: değişken ismi bekleniyor\n"; - return vd; - } - - vd->name = currentToken().token->token; - nextToken(); // İsmi tüket - - // Opsiyonel array boyutu: [expr] - if (currentToken().type == TokenType::LBRACKET) { - nextToken(); // '[' - while (currentToken().type != TokenType::RBRACKET && - currentToken().type != TokenType::SEMICOLON && - currentToken().type != TokenType::SVR_VOID) - nextToken(); - if (currentToken().type == TokenType::RBRACKET) - nextToken(); // ']' - } - - // İlk değişkenin başlangıç değeri - if (currentToken().type == TokenType::EQUAL) { - nextToken(); // '=' tüket - vd->initExpr = parseExpression(); - } - - // --- Çoklu değişken: , identifier [= expr] --- - while (currentToken().type == TokenType::COMMA) { - nextToken(); // ',' tüket - - if (currentToken().type != TokenType::IDENTIFIER) { - std::cerr << "Parser hatası: virgülden sonra değişken ismi bekleniyor\n"; - break; - } - - VariableDeclNode* sibling = new VariableDeclNode(); - sibling->loc = currentToken().token->loc; - sibling->varType = vd->varType; // Aynı tip - sibling->name = currentToken().token->token; - nextToken(); // İsmi tüket - - // Opsiyonel array boyutu: [expr] - if (currentToken().type == TokenType::LBRACKET) { - nextToken(); // '[' - while (currentToken().type != TokenType::RBRACKET && - currentToken().type != TokenType::SEMICOLON && - currentToken().type != TokenType::SVR_VOID) - nextToken(); - if (currentToken().type == TokenType::RBRACKET) - nextToken(); // ']' - } - - // Başlangıç değeri - if (currentToken().type == TokenType::EQUAL) { - nextToken(); // '=' tüket - sibling->initExpr = parseExpression(); - } - - // Kardeş düğümü ana düğüme ekle - vd->addChild(sibling); - } - - // Noktalı virgül (opsiyonel — parser hoşgörülü) - if (currentToken().type == TokenType::SEMICOLON) - nextToken(); - - return vd; -} - -// ============================================================================ - -#endif // SAQUT_PARSER_DECL diff --git a/src/parser/parser_stmt.hpp b/src/parser/parser_stmt.hpp deleted file mode 100644 index b37e142..0000000 --- a/src/parser/parser_stmt.hpp +++ /dev/null @@ -1,322 +0,0 @@ -// ============================================================================ -// saQut Compiler — Parser Deyimler -// ============================================================================ -// -// DİZİN: src/parser/parser_stmt.hpp -// İÇERİK: parseStatement(), parseBlock(), parseIf/While/For/DoWhile, -// parseReturn/Break/Continue/ExpressionStatement -// -// ============================================================================ - -#ifndef SAQUT_PARSER_STMT -#define SAQUT_PARSER_STMT - -#include -#include "parser/parser_base.hpp" -inline ASTNode* Parser::parseStatement() { - auto ct = currentToken(); - - if (ct.type == TokenType::LBRACE) - return parseBlock(); - - if (ct.type == TokenType::KW_IF) - return parseIfStatement(); - - if (ct.type == TokenType::KW_WHILE) - return parseWhileStatement(); - - if (ct.type == TokenType::KW_FOR) - return parseForStatement(); - - if (ct.type == TokenType::KW_DO) - return parseDoWhileStatement(); - - if (ct.type == TokenType::KW_RETURN) - return parseReturnStatement(); - - if (ct.type == TokenType::KW_BREAK) - return parseBreakStatement(); - - if (ct.type == TokenType::KW_CONTINUE) - return parseContinueStatement(); - - // Değişken tanımı? (tip keyword'ü ile başlayan) - if (ct.is({ - TokenType::KW_VOID, TokenType::KW_INT, TokenType::KW_FLOAT_TYPE, - TokenType::KW_DOUBLE, TokenType::KW_BOOL, TokenType::KW_CHAR, - TokenType::KW_STRING_TYPE - })) { - return parseVariableDecl(); - } - - // struct tanımı: struct Name { ... } - if (ct.type == TokenType::KW_STRUCT) - return parseStructDecl(); - - // Hiçbiri değilse → ifade statement'ı (atama, fonksiyon çağrısı, ...) - return parseExpressionStatement(); -} - -// -------------------------------------------------------------------------- -// parseBlock: { statement* } -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseBlock() { - BlockNode* block = new BlockNode(); - block->loc = currentToken().token ? currentToken().token->loc : SourceLocation{}; - - if (currentToken().type == TokenType::LBRACE) - nextToken(); // '{' tüket - - while (currentToken().type != TokenType::RBRACE && - currentToken().type != TokenType::SVR_VOID) { - ASTNode* stmt = parseStatement(); - if (stmt) - block->addChild(stmt); - else - break; // Hata durumunda döngüden çık - } - - if (currentToken().type == TokenType::RBRACE) - nextToken(); // '}' tüket - - return block; -} - -// -------------------------------------------------------------------------- -// parseIfStatement: if (expression) statement [else statement] -// -// Süslü parantez zorunlu DEĞİL — tek statement de olabilir. -// if (x > 5) return x; ← geçerli -// if (x > 5) { ... } ← geçerli -// -// TODO: Sallantılı else (dangling else) sorunu: -// if (a) if (b) x; else y; ← else hangi if'e ait? -// Mevcut implementasyon doğru: else en yakın if'e bağlanır. -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseIfStatement() { - IfStatementNode* ifNode = new IfStatementNode(); - ifNode->loc = currentToken().token->loc; - nextToken(); // 'if' tüket - - // Koşul: ( expression ) - if (currentToken().type == TokenType::LPAREN) { - nextToken(); // '(' tüket - ifNode->condition = parseExpression(); - if (currentToken().type == TokenType::RPAREN) - nextToken(); // ')' tüket - } - - // Then gövdesi - ifNode->thenBranch = parseStatement(); - - // Opsiyonel else - if (currentToken().type == TokenType::KW_ELSE) { - nextToken(); // 'else' tüket - ifNode->elseBranch = parseStatement(); - } - - return ifNode; -} - -// -------------------------------------------------------------------------- -// parseWhileStatement: while (expression) statement -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseWhileStatement() { - WhileStatementNode* ws = new WhileStatementNode(); - ws->loc = currentToken().token->loc; - nextToken(); // 'while' tüket - - if (currentToken().type == TokenType::LPAREN) { - nextToken(); // '(' tüket - ws->condition = parseExpression(); - if (currentToken().type == TokenType::RPAREN) - nextToken(); // ')' tüket - } - - ws->body = parseStatement(); - return ws; -} - -// -------------------------------------------------------------------------- -// parseForStatement: for (init; condition; update) statement -// -// for'un 3 parçası da isteğe bağlıdır: -// for (;;) { ... } ← sonsuz döngü (geçerli) -// -// init: VariableDeclNode veya ExpressionStatementNode -// for (int i = 0; ...) → VariableDecl -// for (i = 0; ...) → ExpressionStatement -// condition: ifade (nullptr = yok) -// update: ifade (nullptr = yok) -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseForStatement() { - ForStatementNode* fs = new ForStatementNode(); - fs->loc = currentToken().token->loc; - nextToken(); // 'for' tüket - - if (currentToken().type == TokenType::LPAREN) - nextToken(); // '(' tüket - - // Init (opsiyonel) - if (currentToken().type != TokenType::SEMICOLON) - fs->init = parseStatement(); - if (currentToken().type == TokenType::SEMICOLON) - nextToken(); // ';' tüket - - // Condition (opsiyonel) - if (currentToken().type != TokenType::SEMICOLON) - fs->condition = parseExpression(); - if (currentToken().type == TokenType::SEMICOLON) - nextToken(); // ';' tüket - - // Update (opsiyonel) - if (currentToken().type != TokenType::RPAREN) - fs->update = parseExpression(); - if (currentToken().type == TokenType::RPAREN) - nextToken(); // ')' tüket - - // Body - fs->body = parseStatement(); - - return fs; -} - -// -------------------------------------------------------------------------- -// parseDoWhileStatement: do statement while (expression) ; -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseDoWhileStatement() { - DoWhileStatementNode* dw = new DoWhileStatementNode(); - dw->loc = currentToken().token->loc; - nextToken(); // 'do' tüket - - // Gövde - dw->body = parseStatement(); - - // while (expression) ; - if (currentToken().type == TokenType::KW_WHILE) { - nextToken(); // 'while' tüket - if (currentToken().type == TokenType::LPAREN) { - nextToken(); // '(' tüket - dw->condition = parseExpression(); - if (currentToken().type == TokenType::RPAREN) - nextToken(); // ')' tüket - } - if (currentToken().type == TokenType::SEMICOLON) - nextToken(); // ';' tüket - } - - return dw; -} - -// -------------------------------------------------------------------------- -// parseReturnStatement: return [expression] ; -// -// return; ← value = nullptr (void fonksiyon) -// return x + 1; ← value = BinaryExpression -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseReturnStatement() { - ReturnStatementNode* rs = new ReturnStatementNode(); - rs->loc = currentToken().token->loc; - nextToken(); // 'return' tüket - - // Opsiyonel dönüş değeri - // Eğer sıradaki token ; veya } ise → return; - if (currentToken().type != TokenType::SEMICOLON && - currentToken().type != TokenType::RBRACE) { - rs->value = parseExpression(); - } - - if (currentToken().type == TokenType::SEMICOLON) - nextToken(); // ';' tüket - - return rs; -} - -// -------------------------------------------------------------------------- -// parseBreakStatement / parseContinueStatement -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseBreakStatement() { - BreakStatementNode* bs = new BreakStatementNode(); - bs->loc = currentToken().token->loc; - nextToken(); // 'break' tüket - if (currentToken().type == TokenType::SEMICOLON) - nextToken(); - return bs; -} - -inline ASTNode* Parser::parseContinueStatement() { - ContinueStatementNode* cs = new ContinueStatementNode(); - cs->loc = currentToken().token->loc; - nextToken(); // 'continue' tüket - if (currentToken().type == TokenType::SEMICOLON) - nextToken(); - return cs; -} - -// -------------------------------------------------------------------------- -// parseExpressionStatement: expression ; -// -// Bir ifadeyi statement olarak kullanır. Örn: x = 5; foo(); -// -// HATA KURTARMA: -// Eğer parseExpression() başarısız olursa (nullptr), sonraki ; veya } -// veya EOF'a kadar token'ları atlayarak senkronize olur. Bu, tek bir -// hatalı ifadenin tüm parser'ı kilitlemesini önler. -// -// BUG FIX (commit 438bc0e): Eskiden hatalı ifade durumunda sonsuz -// döngüye giriyordu (parseProgram her seferinde aynı ifadeyi okuyordu). -// -------------------------------------------------------------------------- -inline ASTNode* Parser::parseExpressionStatement() { - ExpressionStatementNode* es = new ExpressionStatementNode(); - es->loc = currentToken().token ? currentToken().token->loc : SourceLocation{}; - es->expression = parseExpression(); - if (!es->expression) { - // Hata kurtarma: sonraki güvenli noktaya atla - while (currentToken().type != TokenType::SEMICOLON && - currentToken().type != TokenType::RBRACE && - currentToken().type != TokenType::SVR_VOID) - nextToken(); - if (currentToken().type == TokenType::SEMICOLON) - nextToken(); - } - if (currentToken().type == TokenType::SEMICOLON) - nextToken(); - - return es; -} - -// ============================================================================ -// İfadeler — Pratt Parser (Top-Down Operator Precedence) -// ============================================================================ -// -// Pratt parser'ın temel fikri: Her operatörün bir "bağlanma gücü" (precedence) -// vardır. Parser, bu güce göre operatörleri doğru sırada gruplar. -// -// NUD (Null Denotation): Prefix ifadeleri (sayılar, -, !, parantez) -// LED (Left Denotation): Infix/Postfix ifadeler (+, *, ++) -// -// ÖRNEK: 1 + 2 * 3 -// 1. NUD: 1 → Literal(1) -// 2. LED(+): prec=13, right'i parseExpression(13) ile ayrıştır -// 2a. NUD: 2 → Literal(2) -// 2b. LED(*): prec=14 > 13 → parseExpression(14) -// 3a. NUD: 3 → Literal(3) -// 3b. LED yok → dön -// 2c. BinaryExpr(*, 2, 3) dön -// 3. BinaryExpr(+, 1, BinaryExpr(*, 2, 3)) -// Sonuç: 1 + (2 * 3) ✓ -// -// BUG FIX (commit 40579ca): Ana döngü lookahead(1) yerine currentToken() -// kullanıyor. NUD artık token'ı tüketip ilerliyor, bu sayede currentToken() -// her zaman bir sonraki operatörü gösterir. -// -// BUG FIX (commit 438bc0e): Atom'lar (sayı, string, identifier) NUD'da -// nextToken() ile tüketiliyor. Eskiden tüketilmediği için sonsuz döngü -// oluyordu. -// -// ============================================================================ - -// -------------------------------------------------------------------------- -// parseExpression(): Öncelik 0'dan başla (en düşük bağlanma) - -#endif // SAQUT_PARSER_STMT diff --git a/src/tokenizer/tokenizer.cpp b/src/tokenizer/tokenizer.cpp new file mode 100644 index 0000000..02631f8 --- /dev/null +++ b/src/tokenizer/tokenizer.cpp @@ -0,0 +1,176 @@ +#include "tokenizer/tokenizer.hpp" + +std::vector Tokenizer::scan(std::string input) { + std::vector tokens; + hmx.setSourceText("", input); + while (true) { + Token* token = scope(); + if (token->token == "EOL") break; + tokens.push_back(token); + if (hmx.isEnd()) break; + } + return tokens; +} + +Token* Tokenizer::scope() { + hmx.skipWhiteSpace(); + + if (hmx.include("//", true)) { skipOneLineComment(); return scope(); } + if (hmx.include("/*", true)) { skipMultiLineComment(); return scope(); } + + if (hmx.isEnd()) { + Token* t = new Token(); + t->token = "EOL"; + return t; + } + + if (hmx.getchar() == '"') + return readString(); + + if (hmx.isNumeric()) { + INumber lem = hmx.readNumeric(); + NumberToken* nt = new NumberToken(); + nt->loc = lem.startLoc; + nt->base = lem.base; + nt->start = lem.start; + nt->end = lem.end; + nt->hasEpsilon = lem.hasEpsilon; + nt->isFloat = lem.isFloat; + nt->token = lem.token; + return nt; + } + + for (const auto& kw : keywords) { + if (hmx.include(std::string(kw), false)) { + char next = hmx.getchar(static_cast(kw.size())); + if ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z') || + (next >= '0' && next <= '9') || next == '_' || next == '$') { + continue; + } + KeywordToken* kt = new KeywordToken(); + kt->start = hmx.getOffset(); + kt->loc = hmx.getLocation(); + hmx.toChar(static_cast(kw.size())); + kt->end = hmx.getOffset(); + kt->token = kw; + return kt; + } + } + + for (const auto& del : delimiters) { + if (hmx.include(std::string(del), false)) { + DelimiterToken* dt = new DelimiterToken(); + dt->start = hmx.getOffset(); + dt->loc = hmx.getLocation(); + hmx.toChar(static_cast(del.size())); + dt->end = hmx.getOffset(); + dt->token = del; + return dt; + } + } + + for (const auto& op : operators) { + if (hmx.include(std::string(op), false)) { + OperatorToken* ot = new OperatorToken(); + ot->start = hmx.getOffset(); + ot->loc = hmx.getLocation(); + hmx.toChar(static_cast(op.size())); + ot->end = hmx.getOffset(); + ot->token = op; + return ot; + } + } + + return readIdentifier(); +} + +IdentifierToken* Tokenizer::readIdentifier() { + hmx.beginPosition(); + IdentifierToken* it = new IdentifierToken(); + it->start = hmx.getOffset(); + + while (!hmx.isEnd()) { + char c = hmx.getchar(); + bool read = false; + + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) { + read = true; + it->token.push_back(c); + } else if (c == '_' || c == '$') { + read = true; + it->token.push_back(c); + } + + if (read) { + hmx.nextChar(); + } else { + if (it->token.empty()) { hmx.nextChar(); } break; + } + } + + it->end = hmx.getOffset(); + it->size = static_cast(it->context.size()); + it->loc = hmx.sourceFile.offsetToLocation(it->start); + hmx.acceptPosition(); + return it; +} + +StringToken* Tokenizer::readString() { + hmx.beginPosition(); + StringToken* st = new StringToken(); + bool started = false; + bool ended = false; + st->start = hmx.getOffset(); + + while (!hmx.isEnd()) { + char c = hmx.getchar(); + st->token.push_back(c); + switch (c) { + case '"': + if (!started) { + started = true; + } else { + ended = true; + } + break; + case '\\': + hmx.nextChar(); + c = hmx.getchar(); + st->token.push_back(c); + st->context.push_back(c); + break; + default: + st->context.push_back(c); + break; + } + hmx.nextChar(); + if (ended) break; + } + + st->end = hmx.getOffset(); + st->size = static_cast(st->context.size()); + st->loc = hmx.sourceFile.offsetToLocation(st->start); + hmx.acceptPosition(); + return st; +} + +void Tokenizer::skipOneLineComment() { + while (!hmx.isEnd()) { + if (hmx.getchar() == '\n') { + hmx.nextChar(); + hmx.skipWhiteSpace(); + return; + } + hmx.nextChar(); + } +} + +void Tokenizer::skipMultiLineComment() { + while (!hmx.isEnd()) { + if (hmx.include("*/", true)) { + hmx.skipWhiteSpace(); + return; + } + hmx.nextChar(); + } +} diff --git a/src/tokenizer/tokenizer.hpp b/src/tokenizer/tokenizer.hpp index 07ddec8..ca5c80b 100644 --- a/src/tokenizer/tokenizer.hpp +++ b/src/tokenizer/tokenizer.hpp @@ -1,466 +1,60 @@ -// ============================================================================ -// saQut Compiler — Tokenizer (Token Seviyesinde Tarayıcı) -// ============================================================================ -// -// DİZİN: src/tokenizer/tokenizer.hpp -// KATMAN: Katman 2 — Lexer üzerine kurulu -// BAĞIMLI: Lexer (src/lexer/lexer.hpp) -// KULLANAN: Parser (src/parser/parser.hpp), ParserToken (src/parser/token.hpp) -// -// AMAÇ: -// Lexer tarafından sağlanan karakter akışını alıp anlamlı token'lara dönüştürür. -// Token'lar derleyicinin "kelime"leridir — parser'ın anlayacağı en küçük birim. -// -// Üretilen token tipleri (6 adet polimorfik sınıf): -// ┌─────────────────┬──────────────────────────────────┐ -// │ Sınıf │ Örnek token'lar │ -// ├─────────────────┼──────────────────────────────────┤ -// │ NumberToken │ 42, 0xFF, 3.14, 1e10 │ -// │ StringToken │ "merhaba", "satır\niki" │ -// │ OperatorToken │ +, -, *, /, ==, !=, ++, -- │ -// │ DelimiterToken │ (, ), {, }, [, ], ;, ,, ., -> │ -// │ KeywordToken │ if, for, while, int, void │ -// │ IdentifierToken │ x, myVar, _private │ -// └─────────────────┴──────────────────────────────────┘ -// -// ADR-004: Neden Polimorfik Token Sınıfları? -// Seçenek 1 — Tagged union (std::variant): Tüm veriyi tek struct'ta -// +: Bellek tek parça, cache-friendly -// -: Tip eklemek için union'ı değiştirmek gerek -// Seçenek 2 — Class hierarchy (seçilen): Base Token, alt sınıflar -// +: Yeni token tipi eklemek kolay (yeni sınıf türet) -// +: Her token kendi verisini taşır (NumberToken.isFloat, StringToken.context) -// -: Heap tahsisi (new) gerektirir -// -: virtual destructor çağrısı (maliyet: 1 vtable lookup) -// -// Karar: Class hierarchy. Derleyici gibi bir araçta kod netliği ve -// genişletilebilirlik, mikro-performanstan daha önemlidir. -// -// TASARIM KARARLARI: -// 1. Tablolar (operators, delimiters, keywords): constexpr std::string_view dizileri. -// Derleme zamanında sabit, heap tahsisi yok. Sıralama önceliği: -// - Önce keyword'ler: if/for/while gibi kelimeler identifier'lardan önce yakalanmalı -// - Sonra delimiter'lar: -> ve :: gibi 2 karakterliler önce, tek karakterliler sonra -// - Sonra operator'ler: != ve == gibi 2 karakterliler önce, tek karakterliler sonra -// - En son identifier: yukarıdakilerden hiçbirine uymayan her şey -// -// 2. Keyword boundary check: "do" keyword'ü "double" ile karışmasın diye, -// keyword eşleşmesinden sonraki karakter kontrol edilir. Sonraki karakter -// harf/rakam/_/$ ise bu bir keyword değil, identifier'dır. -// -// 3. scope() metodu: Her çağrıldığında bir sonraki token'ı döndürür. -// EOF'da "EOL" isimli özel bir token döndürür (Token tipi, özel değil). -// Bu, boş token listesi sorununu çözer (parser her zaman bir token görür). -// -// 4. Yorum satırları: // (tek satır) ve /* */ (çok satırlı) desteklenir. -// Yorumlar token üretmez, sessizce atlanır. -// NOT: İç içe /* */ yorumları desteklenmez (C standardı gibi). -// -// BİLİNEN SINIRLAMALAR (TODO): -// TODO: String escape sequence'leri tam değil (\x, \u, \U eksik) -// TODO: Char literal: 'a' formatı okunamıyor -// TODO: Raw string: R"(...)" formatı yok -// TODO: Token konum bilgisi (satır/sütun) token'lara eklenmeli -// TODO: Bellek sızıntısı: Token'lar heap'te new ile oluşturuluyor, silme sorumluluğu çağıranda -// -// ============================================================================ - #ifndef SAQUT_TOKENIZER #define SAQUT_TOKENIZER -#include #include #include +#include #include "lexer/lexer.hpp" - #include "tokenizer/token.hpp" -// ============================================================================ -// Token Tanıma Tabloları (Derleme Zamanı Sabitleri) -// ============================================================================ -// -// Bu tablolar, Tokenizer::scope() tarafından ham karakterlerden token üretmek -// için kullanılır. constexpr std::string_view ile tanımlanmıştır, böylece -// heap tahsisi yapılmaz ve derleme zamanında optimize edilir. -// -// SIRALAMA ÖNEMLİDİR! -// scope() fonksiyonu bu tabloları sırasıyla tarar ve İLK eşleşmede durur. -// Bu nedenle: -// - Çok karakterli operatörler (==) tek karakterlilerden (=) ÖNCE gelmeli -// - Çok karakterli delimiter'lar (->) tek karakterlilerden (.) ÖNCE gelmeli -// - Keyword'ler, identifier'lardan ÖNCE kontrol edilmeli -// -// Mevcut sıralama: keywords → delimiters → operators → identifier (fallback) -// -// ============================================================================ - -#include - // Operatör tablosu. Çok karakterliler (==, !=, ++, +=, vb.) önce gelir. -// NOT: Bu tablo ParserToken'daki OPERATOR_MAP ile eşleşmelidir. inline constexpr std::string_view operators[] = { - // --- 2 karakterli: karşılaştırma --- "==", "!=", "<=", ">=", "&&", "||", - // --- 2 karakterli: aritmetik --- "++", "--", "<<", ">>", - // --- 2 karakterli: birleşik atama --- "+=", "-=", "*=", "/=", "%=", "&=", "|=", "^=", - // --- 1 karakterli: aritmetik --- "+", "-", "*", "/", "%", "<", ">", - // --- 1 karakterli: bitsel/mantıksal --- "^", "!", "~", "&", "|", - // --- 1 karakterli: temel atama --- "=" }; // Delimiter tablosu. Çok karakterliler (->, ::) önce gelir. inline constexpr std::string_view delimiters[] = { - "->", "::", // 2 karakterli bağlayıcılar - "[", "]", "(", ")", "{", "}", // gruplama - ";", ",", ":", // ayırıcılar - "." // üye erişimi + "->", "::", + "[", "]", "(", ")", "{", "}", + ";", ",", ":", + "." }; -// Keyword tablosu. Dilin tüm rezerve edilmiş kelimeleri. -// Gruplandırılmıştır: -// - Kontrol akışı: if, else, for, while, do, switch, case, vb. -// - Tipler: void, int, float, double, char, string, bool -// - Literal'lar: true, false, null -// - OOP: class, interface, enum, extends, public, private, vb. -// - Modüller: import, package -// - C/C++ ekleri: const, extern, typedef, sizeof, auto, vb. -// -// BUG FIX (commit 438bc0e): -// Eskiden tip keyword'leri bu listede yoktu. int, float gibi kelimeler -// identifier olarak tokenize ediliyordu. Parser'da KW_INT gibi tipler -// tanımlı olmasına rağmen tokenizer'dan gelmediği için değişken tanımlama -// çalışmıyordu. Tüm eksik keyword'ler eklendi. -// +// Keyword tablosu. inline constexpr std::string_view keywords[] = { - // Control flow "if", "else", "for", "while", "do", "switch", "case", "default", "break", "continue", "return", "try", "catch", "finally", "throw", "throws", "assert", - // Types "void", "int", "float", "double", "char", "string", "bool", - // Literals "true", "false", "null", - // OOP "class", "struct", "interface","enum", "extends", "implements", "new", "public", "private", "protected", "static", "final", "abstract", - // Modules "import", "package", - // C/C++ "const", "extern", "typedef", "sizeof", "auto", "constexpr","noexcept", "native", "synchronized", "volatile", "transient" }; -// ============================================================================ -// Tokenizer — Lexer Üzerinde Token Üretici -// ============================================================================ -// -// Tek sorumluluğu: karakter akışından token listesi üretmek. -// Durum bilgisi: Lexer'ı içerir (hmx), kendi durumu yok. -// -// KULLANIM: -// Tokenizer tokenizer; -// auto tokens = tokenizer.scan(sourceCode); -// // tokens artık kullanılabilir. İş bitince: -// for (auto* t : tokens) delete t; -// class Tokenizer { public: - Lexer hmx; // İç Lexer. "hmx" adı tarihsel. + Lexer hmx; std::vector scan(std::string input); private: - Token* scope(); // Bir sonraki token'ı döndür - IdentifierToken* readIdentifier(); // Tanımlayıcı oku - StringToken* readString(); // String literal oku - void skipOneLineComment(); // // yorum satırını atla - void skipMultiLineComment(); // /* */ yorum bloğunu atla + Token* scope(); + IdentifierToken* readIdentifier(); + StringToken* readString(); + void skipOneLineComment(); + void skipMultiLineComment(); }; -// ============================================================================ -// GERÇEKLEME (Implementation) -// ============================================================================ - -// -------------------------------------------------------------------------- -// scan: Kaynak kodu tara, token listesi üret. -// -// Akış: -// 1. Lexer'a kaynak kodu yükle -// 2. scope() ile tek tek token oku -// 3. "EOL" (End Of Line) token'ı gelene kadar devam et -// 4. Token listesini döndür -// -// "EOL" token'ı: scope() EOF'da üretilen özel bir Token. Parser'a "bitti" sinyali. -// Neden nullptr değil? Çünkü scope() her zaman geçerli bir pointer döndürmeli, -// aksi takdirde null kontrolü gerekir. "EOL" ile bu kontrol token tipine indirgenir. -// -// TODO: std::unique_ptr veya std::vector> ile bellek yönetimi -// -------------------------------------------------------------------------- -inline std::vector Tokenizer::scan(std::string input) { - std::vector tokens; - hmx.setSourceText("", input); // Kaynak kodu hem Lexer'a yükle hem SourceFile'ı hazırla - while (true) { - Token* token = scope(); - if (token->token == "EOL") break; // Dosya sonu sinyali - tokens.push_back(token); - if (hmx.isEnd()) break; // Güvenlik kontrolü - } - return tokens; -} - -// -------------------------------------------------------------------------- -// scope: Bir sonraki token'ı tanı ve döndür. -// -// Token tanıma sıralaması (önemli!): -// 1. Boşlukları atla -// 2. Yorum satırlarını atla (//, /* */) -// 3. EOF kontrolü → "EOL" token'ı -// 4. String literal ("...") -// 5. Sayısal literal (0-9 ile başlayan) -// 6. Keyword'ler (sınır kontrolü ile) -// 7. Delimiter'lar -// 8. Operatörler -// 9. Identifier (fallback — yukarıdakilerden hiçbiri değilse) -// -// Keyword boundary check: -// include(kw, false) ile önce eşleşme kontrolü yapılır (konum değişmez). -// Sonra keyword'ün hemen sonrasındaki karaktere bakılır. -// Eğer bu karakter harf/rakam/_/$ ise, bu bir keyword değil, daha uzun bir -// identifier'ın parçasıdır. Örnek: "do" → "double"ın başlangıcı olabilir. -// -// BUG FIX (commit 438bc0e): Eskiden boundary check yoktu. "double" kelimesi -// "do" + "uble" olarak iki token'a ayrılıyordu. -// -------------------------------------------------------------------------- -inline Token* Tokenizer::scope() { - hmx.skipWhiteSpace(); - - // Yorum satırları: sessizce atla, token üretme - if (hmx.include("//", true)) { skipOneLineComment(); return scope(); } - if (hmx.include("/*", true)) { skipMultiLineComment(); return scope(); } - - // EOF kontrolü - if (hmx.isEnd()) { - Token* t = new Token(); - t->token = "EOL"; // Özel sinyal token'ı - return t; - } - - // String literal: " ile başlar - if (hmx.getchar() == '"') - return readString(); - - // Sayısal literal: rakam ile başlar (isNumeric: 0-9) - if (hmx.isNumeric()) { - INumber lem = hmx.readNumeric(); - NumberToken* nt = new NumberToken(); - nt->loc = lem.startLoc; - nt->base = lem.base; - nt->start = lem.start; - nt->end = lem.end; - nt->hasEpsilon = lem.hasEpsilon; - nt->isFloat = lem.isFloat; - nt->token = lem.token; - return nt; - } - - // Keyword'ler: sınır kontrolü ile tarama - // include(kw, false) → eşleşme kontrolü yap ama konumu değiştirme - // getchar(kw.size()) → keyword sonrası karaktere bak - // Sonraki karakter harf/rakam/_/$ ise → bu bir keyword değil, devam et - for (const auto& kw : keywords) { - if (hmx.include(std::string(kw), false)) { - char next = hmx.getchar(static_cast(kw.size())); - if ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z') || - (next >= '0' && next <= '9') || next == '_' || next == '$') { - continue; // Daha uzun bir identifier'ın parçası - } - KeywordToken* kt = new KeywordToken(); - kt->start = hmx.getOffset(); - kt->loc = hmx.getLocation(); - hmx.toChar(static_cast(kw.size())); - kt->end = hmx.getOffset(); - kt->token = kw; - return kt; - } - } - - // Delimiter'lar - for (const auto& del : delimiters) { - if (hmx.include(std::string(del), false)) { - DelimiterToken* dt = new DelimiterToken(); - dt->start = hmx.getOffset(); - dt->loc = hmx.getLocation(); - hmx.toChar(static_cast(del.size())); - dt->end = hmx.getOffset(); - dt->token = del; - return dt; - } - } - - // Operatörler - for (const auto& op : operators) { - if (hmx.include(std::string(op), false)) { - OperatorToken* ot = new OperatorToken(); - ot->start = hmx.getOffset(); - ot->loc = hmx.getLocation(); - hmx.toChar(static_cast(op.size())); - ot->end = hmx.getOffset(); - ot->token = op; - return ot; - } - } - - // Identifier (fallback): hiçbir özel token tipine uymayan her şey - return readIdentifier(); -} - -// -------------------------------------------------------------------------- -// readIdentifier: Bir tanımlayıcı (identifier) oku. -// -// Tanımlayıcı = harf ile başlayan, harf/rakam/_/$ ile devam eden karakter dizisi. -// NOT: Rakam ile başlayamaz (o zaman sayı olurdu). -// -// Karakter seti: -// a-z, A-Z: Latin harfleri -// 0-9: Rakamlar (ilk karakter hariç) -// _ (alt çizgi): Yaygın ayraç -// $ (dolar): Java/C# uyumluluğu için -// -// TODO: Unicode harf desteği (Türkçe karakterler, Çince, Arapça, vb.) -// -------------------------------------------------------------------------- -inline IdentifierToken* Tokenizer::readIdentifier() { - hmx.beginPosition(); - IdentifierToken* it = new IdentifierToken(); - it->start = hmx.getOffset(); - - while (!hmx.isEnd()) { - char c = hmx.getchar(); - bool read = false; - - // Harf veya rakam kontrolü (ASCII) - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) { - read = true; - it->token.push_back(c); - } else if (c == '_' || c == '$') { - read = true; - it->token.push_back(c); - } - - if (read) { - hmx.nextChar(); - } else { - if (it->token.empty()) { hmx.nextChar(); } break; - } - } - - it->end = hmx.getOffset(); - it->size = static_cast(it->context.size()); - it->loc = hmx.sourceFile.offsetToLocation(it->start); - hmx.acceptPosition(); // Başarılı okuma → konumu kalıcı yap - return it; -} - -// -------------------------------------------------------------------------- -// readString: Bir string literal oku ("...") -// -// Desteklenen escape sequence'ler: -// \" → çift tırnak -// \\ → ters bölü -// \n → satırsonu -// \t → sekme -// \r → satırbaşı -// -// Algoritma: -// 1. Açılış tırnağını (" ) gör → started = true -// 2. Karakterleri oku: -// - \ ise → sonraki karakteri escape olarak işle, context'e ekle -// - " ise → started zaten true, bu kapanış tırnağı → ended = true -// - Diğer → context'e ekle -// 3. Kapanış tırnağında dur -// -// token: Tüm karakterler (tırnaklar ve escape'ler dahil) -// context: Sadece gerçek string içeriği (escape'ler çözülmüş) -// -// Örnek: "a\"b\\n" → token = "\"a\\\"b\\\\n\"", context = "a\"b\n" -// -// TODO: \xNN (hex escape), \uNNNN (Unicode), \UNNNNNNNN (geniş Unicode) -// TODO: Çok satırlı string desteği ("""...""" veya backtick `...`) -// -------------------------------------------------------------------------- -inline StringToken* Tokenizer::readString() { - hmx.beginPosition(); - StringToken* st = new StringToken(); - bool started = false; // Açılış tırnağı görüldü mü? - bool ended = false; // Kapanış tırnağı görüldü mü? - st->start = hmx.getOffset(); - - while (!hmx.isEnd()) { - char c = hmx.getchar(); - st->token.push_back(c); - switch (c) { - case '"': - if (!started) { - started = true; // Açılış tırnağı - } else { - ended = true; // Kapanış tırnağı - } - break; - case '\\': - // Escape sequence: sonraki karakteri olduğu gibi al - hmx.nextChar(); - c = hmx.getchar(); - st->token.push_back(c); - st->context.push_back(c); - break; - default: - st->context.push_back(c); - break; - } - hmx.nextChar(); - if (ended) break; - } - - st->end = hmx.getOffset(); - st->size = static_cast(st->context.size()); - st->loc = hmx.sourceFile.offsetToLocation(st->start); - hmx.acceptPosition(); - return st; -} - -// -------------------------------------------------------------------------- -// skipOneLineComment: // ile başlayan yorum satırını satırsonuna kadar atla -// -------------------------------------------------------------------------- -inline void Tokenizer::skipOneLineComment() { - while (!hmx.isEnd()) { - if (hmx.getchar() == '\n') { - hmx.nextChar(); - hmx.skipWhiteSpace(); // Satırsonu sonrası boşlukları da temizle - return; - } - hmx.nextChar(); - } -} - -// -------------------------------------------------------------------------- -// skipMultiLineComment: /* */ bloğunu atla -// NOT: İç içe yorum blokları desteklenmez (C standardı gibi). -// -------------------------------------------------------------------------- -inline void Tokenizer::skipMultiLineComment() { - while (!hmx.isEnd()) { - if (hmx.include("*/", true)) { - hmx.skipWhiteSpace(); - return; - } - hmx.nextChar(); - } -} - -#endif // SAQUT_TOKENIZER \ No newline at end of file +#endif // SAQUT_TOKENIZER