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 ms5.migadu.com with LMTPS id sFVtKL/e3GYtEAEAe85BDQ:P1 (envelope-from ) for ; Sun, 08 Sep 2024 01:16:15 +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 sFVtKL/e3GYtEAEAe85BDQ (envelope-from ) for ; Sun, 08 Sep 2024 01:16:15 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=QhbrMaa+; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b=hdimQkVT; dmarc=pass (policy=quarantine) header.from=johnnyrichard.com; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1725750975; 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=60L1ulQoyH8a15G3qgtNUvlxvWXPoyd5uEugOxv/8WI=; b=wz9NT3NnH9DZYlNWHG+dQJDehwXJJITyGsJjnz42oucpbHc275mXUmFjAr9S4xbGDvwwOi vswJrv4RcFS4hrfSAKHCIN3PMgPP0PuHZgt+7sN5FNAxDkUK+rm1dPpv/8idsMIBzpmXuo vCXj0wSUkRSPuidgCAlg9rmXEMULsNub4YihPuRrOQfz2Jl1Wu4vJWybaEDxkk3MtyF7Cz JUNHLFFufPRW0jytLsaVWjf9XJVTFooR2MASy6dUq69T+8yuVcDC+Ae2d1BxclXawREBjz sjzS+cE3giY7honw2i9du/drI3CPBu89ikVbHF2lYCLPR6s0vs5Bx4kOzmI0qQ== ARC-Seal: i=1; s=key1; d=johnnyrichard.com; t=1725750975; a=rsa-sha256; cv=none; b=GE4KYifY5bVFMjSQzooLUvC5Bdy71mwaZITbXZwZCk6rbLtihzTZpIaFBzyoaIdy5cd7+K LT6Uh8Cloc7SSDZAiv/URA2lL3RkSAJxV8uZZbgSUTfWlX9UhZjEs1VunABU2CJLLm2QYe 55ndyXzYNJMkowJzQTMeF212Sd6/1yLY8gcrIn+KpZECBHNh4TH76DYXx2oBgJwrHahqUW ftLB2jP6/X9UHWOAe4CHb7QoNJvOSXL96Pl4InS95FyfYkguHUWmYB3JnkIUrLk20Rmnp8 3QRATZlyyGmvsOM+Xf+1MUZ/gSZQDcQDz3XNU1Hyq1rzpgoGifqbI003GeNr7A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=QhbrMaa+; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b=hdimQkVT; dmarc=pass (policy=quarantine) header.from=johnnyrichard.com; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht 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 5C527106F8 for ; Sun, 8 Sep 2024 01:16:14 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=o5SdZN3p/IombKwd7O+UhtsHgSPNnKPK85qDt8HgEy4=; 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=1725750974; v=1; b=QhbrMaa+zDWy7pNS7feZJp4INPAEpyADOQAgvkJbhwfYlzsa5kF6/JxwGSurT9WoM4FAcfrb WvCzVj4TFnd95r62of2t2XGrKXviYc9OXspcfZhFDlVtQJ+Px5xiNq2QWFiEdORCKmVnAQ5ATOu PQDO24lW1hdGcZLoyY/JHDwPQzV7LJxqx8UdBE1Vetw8wQYyHMP2yDxK/Lo89INyfcup3sNlq+p mZPrrmLmEcMISdlU0Jfsp/AfSK8AKh7aFbsY3C83xxEMhtWoMHV2sFdbLgqd1d3HkQ2IYsiUXul FUqvQsoHH+p0RuL5KWSXTcgw9jLdB8i57OC+BmrAXJj0Q== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id D3E7E2025E for ; Sat, 07 Sep 2024 23:16:14 +0000 (UTC) Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) by mail-a.sr.ht (Postfix) with ESMTPS id 4445920152 for <~johnnyrichard/olang-devel@lists.sr.ht>; Sat, 07 Sep 2024 23:16:14 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1725750974; 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=60L1ulQoyH8a15G3qgtNUvlxvWXPoyd5uEugOxv/8WI=; b=hdimQkVTIOBrsl3IR940kNhdXrkdK3pxfyIv++xmzXpa1jzqebRcmnxQTRAjlJgjsJt+aq YwA88H2/Xhe+YyvKqBxCJ3BqM3P1cT3KUm7bVt2IX/nD/QkQuE0ZQneNnVtaeuV97hjn+4 jVXytTaWjm1B2Fm4lfFiszKe7YGkHv7WnF3wbYyF9Cft1Wr6zmxMnmivx/NzTAMg1sZ8+t vI5bLalgEX7Msle5N3f3VIFieqDOkLf5CeINrptwZo5r7Yqg96mYRuMihsSSeF+4zgyVfz lgQZnm5qF49DSv21z60Gv9Tz8M0I3037/RbOnxjPLJyC02NP2sYb4GZnyuSlxQ== From: Johnny Richard To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Johnny Richard Subject: [PATCH olang v2 0/4] add support to compile if statements Date: Sun, 8 Sep 2024 03:10:54 +0200 Message-ID: <20240908011512.152684-2-johnny@johnnyrichard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-Queue-Id: 5C527106F8 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -5.89 X-Spam-Score: -5.89 X-TUID: 1dcbxRIjO+Dg This first interaction we implemented compilation for simple _if_ statements without _else_ and _else-if_ support. V2: I changed patch manually and it corrupted the object id and the patch as a whole. Supersedes - Message-ID: <20240908003402.145538-1-johnny@johnnyrichard.com> Carlos Maniero (2): lexer: add support to if token parser: parse a simple if statement Johnny Richard (2): codegen: x86_64: add support to emit if statements codegen: x86_64: add if cond support for literals src/ast.c | 13 +++ src/ast.h | 11 +++ src/codegen_linux_x86_64.c | 64 +++++++++++---- src/lexer.c | 5 ++ src/lexer.h | 1 + src/parser.c | 79 ++++++++++++++++++- src/pretty_print_ast.c | 14 ++++ tests/integration/tests/0020_if_statement.ol | 43 ++++++++++ .../tests/0021_if_statement_failed.ol | 24 ++++++ .../tests/0022_if_statement_literal.ol | 24 ++++++ 10 files changed, 260 insertions(+), 18 deletions(-) create mode 100644 tests/integration/tests/0020_if_statement.ol create mode 100644 tests/integration/tests/0021_if_statement_failed.ol create mode 100644 tests/integration/tests/0022_if_statement_literal.ol base-commit: 83b791b252e46b6bf081bcd75c8e34c03c45681f -- 2.46.0