From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.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 8Nt4C88/GmdnDAAA62LTzQ:P1 (envelope-from ) for ; Thu, 24 Oct 2024 14:38:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 8Nt4C88/GmdnDAAA62LTzQ (envelope-from ) for ; Thu, 24 Oct 2024 14:38:39 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=Kh7md2TF; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=C9pN8eT8; 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=1729773519; 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=WRe1CV17dBBRw5pl0qdD3/x1xiWTG4uDqYsYK+fnbDA=; b=T/jxOECQz8zdyw5YNys9PTGoe5tFTpDUEKDCCsPtFhDkPts2gh/rsIatrKm/d5Sw3HxHzh 0hd3GqMJ8a/lo/83wcTMKjZnaMH1wAwGL6gfUIeGMA1HIpuRwSXVJVKXJ0BP3oNNEAzo1x tQ53ccnNnZrLRnA/qFLY8kC4CFrjFTaO0MQjIGah7W+ttsZPFmxRZlN85K4J8ZoS2OrXO9 nPInTDm7WniOVU65f/y1FrimueC+NoAkyASonnoYDrEAcbbOsyRSWyZjLgRX6BwjRvfzUu USqwcgr3m4Rgbj794AsyNL0kMsCsHfDygA0DvdL7T0FUif3TuRhy5UFspL2k0w== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=Kh7md2TF; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=C9pN8eT8; 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=1729773519; a=rsa-sha256; cv=pass; b=nB+/8OsiaM8sj2Kctz4MoqU0+nGvd2cOksIIKi8m8ynw+69sISdlobf/DNr3eZ8pVwhruq u6sGpHHdbd93+bZmVyan3+OyAh4BnbgpSZtqwyJ4y6XgHxYYJNUfYkRv9L/xS9yBxaqI1s R38g2ZgUvayEtW81xhauQFjsoPLD7hc26X6RnOFq2IsZyUHpWKfmmxqIbs6ED7SihIqUDo WIAkWBi9/RFZmIgqTFetHJ+CnYMxnH/d7sqSk4xRmdK/mQ6FKLnpZltrenWq6POPs6Ltn1 lN8Dj1zBYAMaXpoOt6CYKP3kRDAZt4TUmLXeRE+Xy/dFbfQfpiUcEBhCHh2WPQ== 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 836B178D9F for ; Thu, 24 Oct 2024 14:38:38 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=ShEUzMFQzqYFQ96DXnsfbUIN18WGeIJR3N/B28eo0Ug=; 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=1729773518; v=1; b=Kh7md2TFdV60G/SVCPl5UgYzaq0HBWTAjFX2QGsr3D8noSY2w6/81JpT0oJwHQoceiUsFFoH YYTY3tMagpesBOO/7DKJt/uNDnVmtfbUl11nGdwUFhbE7mPhYInvFOrQ4SYLVAPDrtvJaNi0UZw FiQrPpWCIgtIHfI5X71hhDE2jK+A7FGJ/EqSuZBdradESle1KG4F1+Dw3xf5/hl2nuERAWnw+Da XmQ+GwLwAk17jGZI7SvfHyWqCJfrTKnNgJjgpubvqGv+cD35wc+7HYkckn4WCl0G611u7Vl31CY bcp7L+pvQs9M7Py6vvc/pIKdLwiMbLjYVgOyTiGXoO5IA== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 4270E20350 for ; Thu, 24 Oct 2024 12:38:38 +0000 (UTC) Received: from buffalo.tulip.relay.mailchannels.net (buffalo.tulip.relay.mailchannels.net [23.83.218.24]) by mail-a.sr.ht (Postfix) with ESMTPS id C373C20347 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 24 Oct 2024 12:38:36 +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 B57CC1800CD for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 24 Oct 2024 12:38:34 +0000 (UTC) Received: from nl-srv-smtpout1.hostinger.io (100-98-255-211.trex-nlb.outbound.svc.cluster.local [100.98.255.211]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id DDE791846CA for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 24 Oct 2024 12:38:33 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1729773514; a=rsa-sha256; cv=none; b=aUROCnLGphb/LyWFO7FWZB4HTgoy6NvGDF0xqUCXLh20CXENcM7MhOyFf+RbjJTvqzTTNm qxC9+C6Pik9TysJSthsnBu/su7RJYO6fyf4Ldt/f/OqIwRbjQh9IfZrblJf+1ctWdcl6eY Awhg0fXUKO6e6JbATz9I0dU6EfONzQC1pgsl1RJXCsAdgTqoLv08YMj9Msvc3ajh0ciuQL RGNJganKwpSnA4Z/4MuclcD2uXPYdNQKZejUbm/BPB2Z1EW7FnbAr7ij+4d10f4+kU31XG eFPOH+Lnnb6K3T/GPcBlB5uDTo55AIExjuGzKHqHvWST4WROuNXpFFZp97CgTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1729773514; 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=WRe1CV17dBBRw5pl0qdD3/x1xiWTG4uDqYsYK+fnbDA=; b=S25rZ1l8GuaQsqnnxPhWdTytNs/VrklFiiC/yo09DcWnXwcuGbSZD3Sg7GSLuLgmMAMpUs I56A3OS7Ebm7NncNEO3vGPXhN4UoMdqKRiSymfr12maSOpJChfU6uMQ7APMcNh+F8GTaWy CvaCunydw0lLPx5ORr2X48iFfChDRa4eDHVULmbSOLYdMlBwLkR7QwZel8fXH5YFUUpzrN 0yzCkNuDbQn8QZ4yvf0e7ebYveQ53JVbpaqhKtmV7rk4S0q7G7t9ZzzozRB9x7qrcPVOaB S79o9AkNkEbJhdPpD3R5VYMLwZ5cPESPMSDGFY75BG52kal+VZVQemNCK2KE9Q== ARC-Authentication-Results: i=1; rspamd-7767f6b98-6kpf2; 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-Hysterical-Battle: 1d17c40f7a0158b9_1729773514384_2122081160 X-MC-Loop-Signature: 1729773514384:2279191059 X-MC-Ingress-Time: 1729773514384 Received: from nl-srv-smtpout1.hostinger.io (nl-srv-smtpout1.hostinger.io [145.14.150.87]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.98.255.211 (trex/7.0.2); Thu, 24 Oct 2024 12:38:34 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1729773512; 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=WRe1CV17dBBRw5pl0qdD3/x1xiWTG4uDqYsYK+fnbDA=; b=C9pN8eT8VDYEMSjWZpbV4ZGVDoAPgBpM47VOiIb7Yw+PzZ4HjRCDwiykZw9FnLQSLfsKNn smDZrssFC8NC841ZNLvz2u4uv0J77xTwTS8xsORRpim+X0HxgWIdnO3X1VXbqaArA65KE/ vV/vwX4i1FelkxSyNfqYKS2+XEudgePZ+/0IMt9v8Sg8TYsTMk0ieKqOCj1ZWFaQcfrxk2 pvIypwkZQMp6qS/3WquWjKhkgaDXq9s9sTqXcAgIV9lCObWp9N7kSWprZgIR4PKrwAac/y IxUuDhaHDVBp/FUD2uIzZJQUZx8vl2/Uky1Z1ESCH69wAcMAcI66eKgRhR6oPQ== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v1 0/6] Remove symbol lookups from codegen Message-ID: <20241024123825.120390-1-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Thu, 24 Oct 2024 12:38:31 +0000 (UTC) X-CM-Envelope: MS4xfOdJOJBdLGXFkaisJ7u8OBOknoZU0xZqQ8Rlqk4bRThm6NcT01BaIMblVedNnArnTysx/+wCI+Ag2bw5HFAMXT6GVBhnb7LRXF5btDkdUB6RfG+bQlnH E1EzXwj5slYq/0rgLCKUPnSo5Opt3GgrVr2aPYoaCOXvAVq+R4KCTSGJBCC2M2YFM+v7LslJgmcUKv7dUNfxkolKLqjVlP1NHy/R0qVgHdjJBRpTxxTLRCL2 X-CM-Analysis: v=2.4 cv=VemlP0p9 c=1 sm=1 tr=0 ts=671a3fc8 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.54 X-Spam-Score: -1.54 X-Migadu-Queue-Id: 836B178D9F X-TUID: VQ2C+DfhDLPO 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. Carlos Maniero (6): ast: create the ast_id_t and apply it to var_def and ref semantics: resolve variable symbols semantics: refactor: use the ast_id_t into the fn_call node semantics: refactor: use the ast_id_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 | 8 +- src/ast.h | 26 +++---- src/codegen_x86_64.c | 47 ++++-------- src/pretty_print_ast.c | 17 +++-- src/type.c | 8 +- src/type.h | 25 ++++--- src/type_checker.c | 161 ++++++++++++++++++++++++++++++++++++----- 7 files changed, 201 insertions(+), 91 deletions(-) base-commit: f87fb371a0105a458be07bd3f269bb45da913d16 -- 2.46.1