From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id 67CED3858C31 for ; Tue, 27 Feb 2024 09:15:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 67CED3858C31 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 67CED3858C31 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709025343; cv=none; b=XKd8vhwTO5BDZQ1z1p3lNPfggXdZkGDJUF0r4DjPR3Oe8FWe6rn8p79zuFnBmpUZlQTC2mXDFuR5RKmIpGNvpov/xCbn0JqDDhiiefxlEtWcd0/qsRnJ1DcWo+S9AIbH3T8hTvHoeywPAvaqdRTaICihn8dy286B3Hr4Mk1t4UM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709025343; c=relaxed/simple; bh=Mqz45sZ0rLDLw3RpN+TLKeun4u6VKeVTGbb5usF9Nxs=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=d3j99uajJxG/RHIZlY79hSW/JozPMDNpra/nR48TIXIELpkAXzxBqZXA2sM6ITLe8K1syJ1Q98sfh1lTHtjYai2qb6vYvETsdkW28PLPWBadM6m1DNx65E6mwTLnwZs9VefnS/R0DGyeRfzAekkjqmmaxPC3YuoGRWNMAiV74rQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-512d19e2cb8so6007755e87.0 for ; Tue, 27 Feb 2024 01:15:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709025340; x=1709630140; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vYjA1Cp/URLcdVe5GUP1HSJF+bPy1gFwSFgf3gRU0IY=; b=CakDysyeJuoqK7A0XvHd4r9kcryFLiu7wQiaQ611shxxf/CiHHeBfMft/wldJIS9e9 d4ApnWK77xyVUx90W9xz3PM1cdcK3JrHRGohTWyvslS2lExv4EYKxBXA3M9Sa9uVNcFL AXboowdh/WXmceRgELL+KINz8KlAvhljVMDJs43OYUkde5Z/bWmJY7ndE8LqyPemX+F+ ZvyUvRMxr9cy0BSe0tfBiaVCEcxVuRirvWOaH3khoUc2mLVCxKYeuYqbPvkzsqZ+T86u VUA7pn5LImS32sjXtfIa3aeJ4j9zVC9J5kBg5XALXUggRraildIfMlbs/8KxOyxQ/4O3 WguQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709025340; x=1709630140; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vYjA1Cp/URLcdVe5GUP1HSJF+bPy1gFwSFgf3gRU0IY=; b=kvORgYkrnLC0pZ3llDjHze9hH+zQLSHfCRJ0ja5yp6u+3IH2A1WjbN84g++olJeFjT pXjY18YzlluU3pddwdKs5ChDoSPkqmb53ukxCC6MAxrzoMvgkg/uK+S0Yx/hbckxjC2D T6mSPlq3zk5u6CuVugHEjjO77JXDExsaGDNyLxIgcYXoYjFcHaQjjFtnVJ1uyG578539 7kD6sojGfdUHBNuGa446S+Y/yQ5W6irsrsqxsIP9QEZ/b0Z0U8pSidUvjTkrkg1N09s9 hXdmi2h5kdt85i1d4iyCsNZCN0QtoIc2GBsOiRBkTzkP0r/uL01NoMEDBUyCPhx3DmGu thEw== X-Gm-Message-State: AOJu0YwFNRIbsizct70wX5lckl/WneD06MGXAziXuzvLYhdjehiXQw+Z FO9JvCqjOhd24YX/AVWmUqfPbQXiuok5MGhNeX6zy/JIk/AeoJedRTVbrtA9xpeQmh4LAUFGsYJ EytbqZVhrfIomK72kAtFzZ9mlAdInbnwb X-Google-Smtp-Source: AGHT+IH/LQYtbz/YgFGLSdNa6Jf4PJbcj6fR1cDpJmWxI5nrjIG8EFW3bHo8O+0V0ArXxcC1F+DFwjt8gxBjUvwrsc4= X-Received: by 2002:ac2:58f9:0:b0:512:8de5:2170 with SMTP id v25-20020ac258f9000000b005128de52170mr4577892lfo.38.1709025339560; Tue, 27 Feb 2024 01:15:39 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Tue, 27 Feb 2024 10:15:28 +0100 Message-ID: Subject: Re: Discussing gcc font end hobby project To: Miro Palmu Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Feb 23, 2024 at 10:22=E2=80=AFAM Miro Palmu via Gcc wrote: > > Hi. > > I have a idea about long term hobby project relating to gcc, > so with this email I'm asking feedback about the idea > early rather than later. First little bit of context. > > I'm a student deep in a university course about compilers > and I have been writing a compiler for language > which is a subset of Herb Sutter's Cpp2. > I chose this because I'm bit of a Cpp language nerd, > and I can apply all of my Cpp knowledge to this project, which is fun. > > After the course I'm interested in converting this to a front end to gcc, > with goal of learning about front end development to gcc. > (It is a non-goal to try to upstream the project.) > > I don't see any obvious reason why this would not be possible. > It just need to be able to target (C++ version of ?) GENERIC. > This would be the first goal of the compiler > and would serve as the MVP of the project. > Below is discussing/theorizing post MVP goals. Note there is no textual form of GENERIC that a GCC compiler binary could parse. So your Cpp compiler would need to build GENERIC data structures itself, basically be a real GCC language frontend. The alternative is to use GCCs JIT but that emits GIMPLE only (I think there's a rust frontend project that tries to leverage that, and also GNU emacs is using it). > Because the Herb Sutter's cppfront transpiles Cpp2 to Cpp1, > it is easy to have mix of Cpp1 and Cpp2 global level constructs > in the same file. Just generate forward declarations of everything, > keep Cpp1 definitions unchanged and transpile the Cpp2 ones. > > At the moment my subset Cpp2 does not support this compatibility > but it would be nice to have at some point. > But if my front end targets GENERIC I would have to use g++ machinery > to turn the Cpp1 parts to GENERIC and then somehow combine the trees. > I imagine that somebody with more experienced with GENERICs would have > a intuition on how hard this combinations would be to implement. > I'm curious about this intuition which I lack. > > In Cpp2 one can import and export Cpp1 modules. With transpiling to > Cpp1 this again is easy implement but with potential front end, > I'm not sure. I'm quite ignorant on Compiled Module Interface (CMI) > implementation in gcc, so I'm asking just for guidance on where to look > if one would want to learn on how CMIs are implemented. There's no generic code for implementing CMIs, each frontend requiring such does need to implement that on its own. Hope this helps, Richard. > Thanks! > > -- > Miro Palmu