From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 0C9jH3JdGGeiKgEAe85BDQ:P1 (envelope-from ) for ; Wed, 23 Oct 2024 04:20:34 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 0C9jH3JdGGeiKgEAe85BDQ (envelope-from ) for ; Wed, 23 Oct 2024 04:20:34 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b="Bvw/5ezw"; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=jNDvb1Mi; dmarc=pass (policy=none) header.from=maniero.me; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1729650034; a=rsa-sha256; cv=pass; b=2skng5zrA4A12lNyEN4AQXD9KeccfA39pssNL9IkPaUy2UVc5X88COt3FZ1Mrjri/ZD0JZ 2I/zof9MhaTk56kPQ85WPWjcIl7h5tdNwwLk0iJwwmx+EZpSL9v/lVj7fovjbC9X58VqOJ okU4jHhn5ExvPllVuWKmCdxIpG/j/GBjwgQm89MYKp5wuIgUAay+fNPNrgg7ND6GeUgfNR rSThE0ER2zsQYnKdVgrb0cWM6MUODygd6w+eIk1Io2A07EIkw064a78t9OIj9S6ZWAxDk2 C0C8e3cARU1VaQF4SdLiVYnfK8yqy7wQB3jyCtC6cV402yibP2FeqndvUiWmwg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b="Bvw/5ezw"; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=jNDvb1Mi; dmarc=pass (policy=none) header.from=maniero.me; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; 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=1729650034; 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=XpLYlSw2uBg1j+qEobBbGhFpmY1Igig2l9DK0p8F6ik=; b=wdNkpg1Q5YwYuM2U+4SodpzQ4V+gRuMYqg/ombOEKHOPTQkP0VqpW7vUNNut3G1UmFzNmf LkonsSXpUHwuw0S/S1EH2cdc4wyv37G8zYWTo5tOQI1Z3UP671zW3rakv11gjc2XB+dxaL UvPwWQaFCECLGsl0kNNSMA5j7kRDzeO+xO+LZLsJl4wX1at7QBWJW+BMeP/2JyAsEkwpT0 y9bANDyrKQCC2aVomnCprrrS3XO3q9jhEkFRMT8IEJwV0OQ1+7c+gF8Cj5v6mTpl3nAZ8Z w1+RFEK2yCFXhO8TFqW+e/uh/opIf3MO4b4gWnI3PVoYWKpoFfIfQk1v8TEiLg== 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 527E0185A3 for ; Wed, 23 Oct 2024 04:20:34 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=qKy1qM1xF1UPMyHlivXucmC04j3QLImtyOSxC3HkFuw=; 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=1729650033; v=1; b=Bvw/5ezwJXrQq5m+McCaqevAh3+3WKVaII8w6q095fcjiInhltOnq5Eq6xdSuoWeZYdufaVo lPbLkLAQv8qBnbblMkrctrPhA8ipTc82/jK94j7lpRfkEdcRluqBdGKjPE7yyzH66aiN0X+cvTb SdMU60f0DjJBl2zkCziL6wHoQPCGvgMkT5uSLe/V74wNjR85ivdMCf3VrgpB6ejeWQk6QdSsFi+ wG+x+4B2gZKZ4e5GQt1/PuN0YI/sHDkNh63dsZkQBinVLxIjyp3zxWVeF9XpPkAHAS8w2v11+Et vZk0Q4VBGYTnzpqMgxDVWHIjpJIjcBDdfedCHRlhlpqvg== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id BA1C2202BF for ; Wed, 23 Oct 2024 02:20:33 +0000 (UTC) Received: from iguana.tulip.relay.mailchannels.net (iguana.tulip.relay.mailchannels.net [23.83.218.253]) by mail-a.sr.ht (Postfix) with ESMTPS id 5CA34202B1 for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 23 Oct 2024 02:20:32 +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 D82D18A6DDD for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 23 Oct 2024 02:20:30 +0000 (UTC) Received: from fr-int-smtpout5.hostinger.io (trex-5.trex.outbound.svc.cluster.local [100.103.26.202]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 13E308A65AB for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 23 Oct 2024 02:20:29 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1729650030; a=rsa-sha256; cv=none; b=P0GU3r3qfQ36Kbio/vuYiA1AHP4cYQ3N2XyLN7TUA02Qqc9+zm4FKfazs6ELyUYZ3TOJoe AJmz3Sldv/kl8CY2G7qcWTh7sywb47ULsVZJhBHySfI+yO9tHGWM6Rcx1Tn+wQlHtPgE8N feagVK6rfCwlqWuTW3jlz4BUq3dfPwWEJYPTt1/08nEuGPls5U3JsT+5Ef41GUj/tuIXC2 DOEYbzwRi3pUe+upjGf3/PF6l2tt4YIZMAITslnaXj5bL6tSKB0UQ8xG5Rc2EUZbuIDbAJ 24r0vRU07pCmytFW96eJ4WoaPRbHTKcrS3PQy82xoFblLCsrOeiSlUBSbZi9hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1729650030; 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=XpLYlSw2uBg1j+qEobBbGhFpmY1Igig2l9DK0p8F6ik=; b=bc9/aK655VDPG7J/iICU0UrvFeZ1Si4siyEUpYJu3bxevO2g8vQYJf53OvFpdGsXjt3Vwo d3fpfDCT77w9fZaRi7c2RQ3AvDOeYGdwN2E3g1ZI6y9PBuhFYviQrW63Kf3kEYLxNFBI1v RgNLs8AumPdknZjs1q/a1eb63RTRZ7n6bl1KE/FYfSRjSa/pFKwvmV6NeN3AB4tD9TsT5h C0yszXmc/P0Ad+7f1KwyNWQoOEd76oIFbN76kTPujCtU9uzXbrjCD2RIGyEns5Y3FqcwcS IvJdo8icW5kB2+ZxNXhI0cgGXT2iybwpbwpqsqOrEZRboHGAy4mBQ27MN7BlNA== ARC-Authentication-Results: i=1; rspamd-5bbb596db8-sksfx; 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-Lettuce-Madly: 391bc3dc7c443b89_1729650030586_2088392536 X-MC-Loop-Signature: 1729650030586:645367562 X-MC-Ingress-Time: 1729650030586 Received: from fr-int-smtpout5.hostinger.io (fr-int-smtpout5.hostinger.io [89.116.146.168]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.103.26.202 (trex/7.0.2); Wed, 23 Oct 2024 02:20:30 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1729650028; 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=XpLYlSw2uBg1j+qEobBbGhFpmY1Igig2l9DK0p8F6ik=; b=jNDvb1MiUSpeZ0z10qCq3OwmgcTDePh1JmzYzZYVHMgW/UOyA6pEDDbRcICSLMmaSQXc2k +Ra7JuUAAderUgIVNgavQpKjrIidyDZIFAR43Ja+S/IZTBBPjbScdYCfE059ljUq2JfbCK 6BfJlD89V1JC1iM25dA1sqHuQnyuErYoTp900vtXIQ3MHnOg3b0WLQmnxnNmahIMxFM3HE wqPk05H5hujt++YwtxFJ7exDbJdHqQQTF3KZR/yjVdFRxzrBPFDUQrg8kZK3wfEMLw8zxh SR3TVW3k7vdqfveON+4fy6qb5GUG/hbLdA9DdewSv8lfg2a3F40MgW8yzdQMQw== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v1 0/5] Refactors to support semantics Message-ID: <20241023022022.38379-1-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Wed, 23 Oct 2024 02:20:27 +0000 (UTC) X-CM-Envelope: MS4xfNh9Q4oASdL21FivLUfALM0+b7ybZEU6qWtrzdV+k2l0Y7q3bkShu+z5E5uLTdvkBIkxVhvyhFBx1PmNAsR/KI7cOd0rXjgG1/k2A+a1SNha4ZCkfT5C BKUJpEBJ6ZXJXjCgVVwNt2N8WcG3mpoqURN25PiRrXhhy/ddGx9bWzYpxGuIn5Uc8Wez2aVHhyGFnV5jVQNhqVjOu8miQKclFgjioek/jhm/acuXMHW5DRnW X-CM-Analysis: v=2.4 cv=Z6G+H2RA c=1 sm=1 tr=0 ts=67185d6c a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=MM9nCqqWlGpppt97xTgA: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-Flow: FLOW_IN X-Migadu-Country: NL X-Migadu-Spam-Score: -0.75 X-Spam-Score: -0.75 X-Migadu-Queue-Id: 527E0185A3 X-Migadu-Scanner: mx12.migadu.com X-TUID: CKWC0x7sfPmq The semantics is an important part of a compiler but we have postpone handling it so far. But the cost came, and we started to see some extra responsibility on the codegen layer because of the lack of semantics. This patchset does not address semantics per si, but it cover several tech debts to start supporting it. Carlos Maniero (5): type_checker: rename checker to type_checker ast: remove redundancy on ast_node base fields ast: unary: rename ast_unary.expr to ast_unary.operand ast: remove expr reference from return and var assign nodes semantics: add scope to all nodes src/ast.c | 8 ++-- src/ast.h | 67 ++++++++++++++++--------------- src/codegen_aarch64.c | 2 +- src/codegen_x86_64.c | 31 +++++++------- src/main.c | 2 +- src/pretty_print_ast.c | 4 +- src/{checker.c => type_checker.c} | 18 ++++----- src/{checker.h => type_checker.h} | 0 8 files changed, 67 insertions(+), 65 deletions(-) rename src/{checker.c => type_checker.c} (93%) rename src/{checker.h => type_checker.h} (100%) base-commit: 2dbf9a9896e5778535bd3dc1d5069a762d3b94fa -- 2.46.1