From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aMg9APLU3GYkbQEA62LTzQ:P1 (envelope-from ) for ; Sun, 08 Sep 2024 00:34:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id aMg9APLU3GYkbQEA62LTzQ (envelope-from ) for ; Sun, 08 Sep 2024 00:34:26 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=WOGdYofW; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b="oF1/gOJs"; 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=quarantine) header.from=johnnyrichard.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1725748465; 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=eVCMDgqHbLpAllIqUEVP2iwpuov3Ng/hn+oPHmho0W4=; b=bh0a/AohXVSVQJmGPOn/JwSwbbJOVk+X++bNmCJ4PN+tRhoFxq8P9a9+xUbhefoQRjpt8e i842Jn027rF30Gr9NEnPiKi4zIIF4qCF03mrJVi2WimRbEFxuZi6gkevknXYYr4/up8t6N pC36W/GZlXURwg94VjMuT86uJbUKlrJrF+ZO7P3M/wq2eWcfSFBJJMIfymKNAXT0BRZlIg 70kV6ZORITDtQPI53afst4X2luzxYKOXW0gMh9JqHQobskaYDi84OcdotPopdDG5Wym8RK WsSYzSSnHS5V1T/IVrUTzKvyLm1PGuXNo5LYI9iFPoI5rrd/hwR+aOU0b36gwQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=WOGdYofW; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b="oF1/gOJs"; 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=quarantine) header.from=johnnyrichard.com ARC-Seal: i=1; s=key1; d=johnnyrichard.com; t=1725748465; a=rsa-sha256; cv=none; b=Q9u8CIx/I/ZDxg9QZq7FCRb672pbHMznu6xR7GLDuTZL0p+uLMb+vpH86S+LHwjcMIWom2 ioWOj6D68LYEecq+/m6RMWZp/9PAM4PDdqCcjdOgmbFu24Q2LOT10BmgpJjyDCgmKVJ7Az Sw9P2R2XPY83wYOqW87HAYwjJuMumuh2zn24FPP6C69OsqeMm42LwUl2QsfNLBnIJX2fdA nOlI792WvT8gXrssEATFfaEQHdhUL2OzRtTNYjuiRbXSh+Xhr5tjDAt/KsRN3MZB+dns1S 9hpH1KAiq8f3WnPLmnwlck7oLCUbMvdaq/BeaH4GQtatddO00Y/2A26gjEsyHw== 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 8D8A272943 for ; Sun, 08 Sep 2024 00:34:25 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=TS1T0bmzGi+mShLnWQQNhciWBNsjg3vB7pNWfSbWa1E=; 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=1725748464; v=1; b=WOGdYofWQ1CzoO5OMOMPK+kiLhoSF13yE00u3nnAYozlF08ozmRnElCOXmdmIikA1IxGaF0p QkL+gglh7tvi3VJHA6nPfPxYSb0IKDMygP+L9cOJ67Rq5zfSCZxLVan0gCgdKv6Duc3LwVfq6+4 /K9eJ2M8vWAfbEmRK9ki9O2rQO8+nGNBZcK2Xp3DotWu6eBVoabXgUhuudbim9FTZomJel32005 4z9m8eHyKV6M2czurcvadwGe7iT03RLe/NfP5grd7qSg0qPZ/rmU9KkjDwKTGYx56ffAKhCTuJa mzAQCixGgBxKU6XP6k16DkrtU78VQ3LmKH9l5XP9m71eg== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 5125020261 for ; Sat, 07 Sep 2024 22:34:24 +0000 (UTC) Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) by mail-a.sr.ht (Postfix) with ESMTPS id 8710720234 for <~johnnyrichard/olang-devel@lists.sr.ht>; Sat, 07 Sep 2024 22:34:23 +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=1725748463; 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=eVCMDgqHbLpAllIqUEVP2iwpuov3Ng/hn+oPHmho0W4=; b=oF1/gOJsrm4ZI7Gry/AKxG/CGEhPrHzewU00FiqgqrMUI5bgGmLyjcfOaC6O2HDeN9axRr yCjel12h+QyNwW2awJ3sVsiU6DEa9KPA+tXh/cEBaSrn8XcXJTSbfN3E1Xzk9IjgIWXo6t CpYbwVBAjLK4Vgr+6YeDhxENg7+KAHzBfcSOck5CiNMqsOb9Csy+dJbVioiI0e9cuh31w8 bMkR8n8YxA8+Ih/APx1CaTMGFuOBDCbzRQRWRHe6zgPuHD0tnv6KvhYApHqrkD5k2pjoeB HIt80EC6INtPTWPm9DjTL/AFtptentBOzHv4MkJKok6bfIK7EXsj/1OXFjwH7g== From: Johnny Richard To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Johnny Richard Subject: [PATCH olang 0/4] add support to compile if statements Date: Sun, 8 Sep 2024 02:31:08 +0200 Message-ID: <20240908003402.145538-1-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-Country: NL X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 8D8A272943 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -5.89 X-Spam-Score: -5.89 X-TUID: 6SrdKL2yIQ5W This first interaction we implemented compilation for simple _if_ statements without _else_ and _else-if_ support. 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