From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id QFedB871ImfRtgAAe85BDQ:P1 (envelope-from ) for ; Thu, 31 Oct 2024 04:13:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id QFedB871ImfRtgAAe85BDQ (envelope-from ) for ; Thu, 31 Oct 2024 04:13:18 +0100 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=bRuAZf8f; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=NKLjwar7; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1730344397; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=08rnif2FHnGSMwmSEmB1gc7m2o8rk5d15GwrwRSosQw=; b=0FHPvP+JUuxGWvcdC1zcFkEhNnbcfI9xvoV7dkTMvhjo2fCnmabgLnDvSFjlwZTHM3Vydw l03mLJEQUY/qFiYX+BT1iLMRaDi/FZwIytvhaRnNVIUqAu8c6oQG/A8FNgEN6lTJbwyXFM iVAf/E49SC0Jkv/zBeMPNqa4m81re8IBKG95etlYxQFLe3Ed+gXYhvVZxRmhEGcAjSvD75 0US7yHfb5eLlvi719DoauIPrC7g3nzbL2RcoZCHIOEjZz0Y7XkbM4xDSg5QjNEKOywqwzL dwsyrIMcUkwyXxOTHdxqSZruP6HKFHPoCBkg+R3oxPD4qudQS9q/iFWtwf7pqA== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=bRuAZf8f; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=NKLjwar7; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1730344397; a=rsa-sha256; cv=pass; b=31I0F8uwDEUj60NCFXXUlo46MxAjXdlc6/ONe0HpdScZNvPMoitQSWfXwqg11k70xvdxqD 9YiGMDh+SgTFmpJnRK0wxF9/qVu4WxYvSGMc+PReFht55p9FjsoCKVRbmohuWbfNOy2l3e VNx1ZubYy9D179LgwLgQEn/Sm4YCMx/fmGpveJkXmztu4lK1toCtWzo8b265e3NwBMVDGh +AqIHAzqlpaJQvhJcDsS0JXCfOtZxhIaH8NXLdt/XualQLsYVhJsXXXBlus8LyDEPPWI7X K1A/sD+5QTJ/DrVqPeuHWWO6hVcVeVbHqwupWt3pzWmkBQPWgoAyw4vyHI8Q3w== Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5183446499 for ; Thu, 31 Oct 2024 04:13:13 +0100 (CET) DKIM-Signature: a=rsa-sha256; bh=mAZP0hUUlDmZq6z0pwVmNsXMimXOGDekoXZ+J9v/CzA=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:Date:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1730344393; v=1; b=bRuAZf8fB8CJKKZ170ZRqpv6Ay5+4N6I0asvWH+SRASbJxTIrlOeLFq1qVzqG25RoZvMTDuc 9hvHMJAhjTiu8mxFJ4mxDj8trKvrKMDRKm5p2hmL1GjEDaFoMXmCal1iPKE00WU0ib/3G6g5To2 VKFqBDY1eSzt567QDqf5pfEMKX4jLdItImMeL4zowaVfUEQRLpqqK2yxQ7AIyZdlXm8XEJ1flDB 24O2gFOTYpVCondIMTzPEZca4fg0NRBGdseZutkc7kJws18yD/PYVHs211wurkh7oPg0FYyYLfi +pidmHxHTyQxkKWHlTn7/7y1Dx0SV6LBa6xiEDvVqKPxA== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 5D1B520392 for ; Thu, 31 Oct 2024 03:13:13 +0000 (UTC) Received: from rusty.tulip.relay.mailchannels.net (rusty.tulip.relay.mailchannels.net [23.83.218.252]) by mail-a.sr.ht (Postfix) with ESMTPS id D837220383 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 31 Oct 2024 03:13:11 +0000 (UTC) X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3040B8C1C74 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 31 Oct 2024 03:13:10 +0000 (UTC) Received: from uk-fast-smtpout10.hostinger.io (100-101-211-194.trex-nlb.outbound.svc.cluster.local [100.101.211.194]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 767408C1C92 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 31 Oct 2024 03:13:09 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1730344389; a=rsa-sha256; cv=none; b=6iNbgRzzw1wLouqnoR6NKiqK2uLG71wEP7ce17TSI2cYku+dfjlupb2U8vY5JMKRjB984O uugCeGWCSLIrWnwkCSM3LD0bAs/LxXmAXIQrkKXyLH3xsLwNuRCHfbJK6pPGSWFfOlgGlf diZYoxwDSD2613lz9EWNCXJKGoScXB3QMRfYqLELtESBskLDlkLfmgD9MrUxowYCRwqENo HM95JX3+ON/Mh489+YQLWOLcoFSybjwrg9dGRR11ll3/7+KI25ESwXMs6Qb4dG+KwwZ2tJ RaWZEdXIyilCAIz6mgOPXBcS20wrBJvM6eylHYy5/goacyBV3T3fssCGDyLbjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1730344389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=08rnif2FHnGSMwmSEmB1gc7m2o8rk5d15GwrwRSosQw=; b=LltM1ry6gUEbSETxz9KXn0kcxTLUHDrPBhGm8OZmh9eoWIJoPvonQCxhifQKytpFEzseUW vsZLBV+nWFhoW59lnaOjIDDH1Z2tFDESS3BCqj+OmxDtmjrPMZ2mxcKBzmWh0sg5HQ4fcd ukTohGh+5RhB1w9s4UM1n0UAd4MoCp6JyTSADk4Imc27zi9QcFYrHPZ0XJq0EYOFaekX7V 7/CuJqpwPHpbCHdoky5dd9dhbEhmQreaNElw11TtOI0GIDuGyC59HwuF5riyewIbvz+pOq gdHTKEkUVk2+3bDujGlpKrsl0riB8e+U0+XeuFQ+5/3R7yd4wTHC8qvLdodTFQ== ARC-Authentication-Results: i=1; rspamd-77cfccfb8-wx49q; auth=pass smtp.auth=hostingeremail smtp.mailfrom=carlos@maniero.me X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|carlos@maniero.me X-MailChannels-Auth-Id: hostingeremail X-Harmony-Arch: 65a29ca15f5bad86_1730344389964_4282771590 X-MC-Loop-Signature: 1730344389964:486277359 X-MC-Ingress-Time: 1730344389963 Received: from uk-fast-smtpout10.hostinger.io (uk-fast-smtpout10.hostinger.io [145.14.155.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.101.211.194 (trex/7.0.2); Thu, 31 Oct 2024 03:13:09 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1730344387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=08rnif2FHnGSMwmSEmB1gc7m2o8rk5d15GwrwRSosQw=; b=NKLjwar7jl3qmbaDLOweiZL7rcjw48ITGO+YaYUxp9pb0HAVfmeJQY0esoqia9sL8HPqWp YKPiikqDLVbGTLlpxhVQHMEAeOvV7Ap4k5CWKfMrgVSRNhcLmHvf8d5dIeXHa1ey7pbwND JrAsfLwBoBEj/5pz5wEAQ88eLseQCJUFbKDD+xi1TEUkzcCaSVRL2OLaZqIBldv9ePezFR zXqrLf8+fdUeX/9fPmGOqapPG61O2MzNTrjBzem3C1WTtb2sUw7gAVARFsOYwLeJa4ySzh fSyamcBrRSSR8zpDad8QHutdcqeuw5oBOXrWM0SwhHJpx4nKoFaAwghLkeTXRA== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v2 0/6] Remove symbol lookups from codegen Message-ID: <20241031031302.136553-1-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Thu, 31 Oct 2024 03:13:07 +0000 (UTC) X-CM-Envelope: MS4xfKuNCmIyNWXAPxVwZYvBM6sbUsKydxsaQy/tDKZevl1uxFjYj5+TedFRtAWOAmq2msoUV8K3l0oli5sviHyJZcLyNIRbASie6+OiA7nXxaNTHOBh/04P h9rXQsKSXTDTNa/8KS1+Z8CxouDlcpHthFJru+yu8GtWnBkozLGNzZCF3E+DK9lqoqPZ7n4qS3IvqZ9n3S1HNCCdJzj/ZdeLAH+RGc5E8O0cs+sk/4zGNYsY X-CM-Analysis: v=2.4 cv=MYc+uI/f c=1 sm=1 tr=0 ts=6722f5c3 a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=ETOJZ_CViqk9GToc2o8A:9 a=BXDaF_L80NY05PYiAFlV:22 X-AuthUser: carlos@maniero.me List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Country: NL X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -1.50 X-Spam-Score: -1.50 X-Migadu-Queue-Id: 5183446499 X-TUID: DHF+clJfanA/ Until now, the codegen was responsible to make the symbol resolution because we didn't have a semantics layer. Now with the semantics, the symbols are already resolved and saved on the AST. To avoid redundancy and code duplication, a new struct was added to represent identifiers. v2: - rename ast_id_t to ast_ident_t Carlos Maniero (6): ast: create the ast_ident_t and apply it to var_def and ref semantics: resolve variable symbols semantics: refactor: use the ast_ident_t into the fn_call node semantics: refactor: use the ast_ident_t into the fn_def.params type: refactor: rename type.id to type.name ast: remove dead code from var_assign ast node src/ast.c | 14 ++-- src/ast.h | 32 ++++---- src/codegen_x86_64.c | 50 +++++-------- src/pretty_print_ast.c | 18 +++-- src/type.c | 8 +- src/type.h | 25 ++++--- src/type_checker.c | 164 ++++++++++++++++++++++++++++++++++++----- 7 files changed, 213 insertions(+), 98 deletions(-) base-commit: f87fb371a0105a458be07bd3f269bb45da913d16 -- 2.46.1