From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54FE4C07E95 for ; Sat, 3 Jul 2021 02:12:33 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E964613E2 for ; Sat, 3 Jul 2021 02:12:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E964613E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1CB2B82015; Sat, 3 Jul 2021 04:12:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aveQYyP5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E5F2382903; Sat, 3 Jul 2021 04:12:28 +0200 (CEST) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C860081D48 for ; Sat, 3 Jul 2021 04:12:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x82c.google.com with SMTP id f13so8086221qtb.6 for ; Fri, 02 Jul 2021 19:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=G6eGyXVirMvDskF1F3fgV7C0tNnL2zdnFcnGjZRsZw4=; b=aveQYyP5o5YEGgeKL3wzYeg2VH1BO5zY1+4r14498iF11it+gLUzQSNRNm7VIMMyHA uISkSaOQn3VCzGvTcWJTYz5l/YLmoHiu+XF93BxtV7SEKjBRd/UkpEshCkmhUgfPq9/r saN/LMiKEwNyHh97l+qbe/6yvcBL6TFIGlITYUz2GQnKPOKCGOPAEpfhOj5tjrMN3dsS /cRlBQWc+/C1vbV8VcrSuUqpCv84/ajaKsDdqcXATuiWLB3raeh7YpAbXmd0S5wjt70L PUPFVNTXd9b5UhrE6Xcpy0d6TTHxj4mYdxzZhOlwOT4E8lcn+0mQXSqbC1cIsVdZNsot cxZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=G6eGyXVirMvDskF1F3fgV7C0tNnL2zdnFcnGjZRsZw4=; b=G5J1hpvkpCnc/sw7UI+lB5TfzjgijkdZgXMaszWKw5EAwZv2d/N8p/aRF4Q9ZB7bXZ ScYStByPINCcC5VgP5qyIMvmNmCNdGvY5BhyUZk7ct51NXH2N453fCeFdfM/ieKF6Wsc tj8WmaBHrlMemgRRcyxH0So0/8hI9cAJe5WQdw86pE1muHYy03QSGQUX+MHrvea8ORpu rYqc+IVDhB+j5sKbBHEaZfy7ykR31/gMxPAtMxgWqiemcy90uxtOK4UFWlyqlPbZIsd7 6OWWNkYRRSgXc53kqIQOGW8p4PmSL2EAGDHA2qKobHvS71o7H5ASz7tFPdb5U/rRKM9N DVCA== X-Gm-Message-State: AOAM533JQcRMSzjlXHcRiu2zQueXa92RcWVORyy7FxYlvR/omcNMW+sh 7Z7EG7NCypQTeB9nIjCGHf8= X-Google-Smtp-Source: ABdhPJy11cA6Y00/BvyoPNc126pKvuAbhGXUOAcAe8iIo7Q8Q+Dv/vY86MWNmTcoHo+u1Sq8UCCw1A== X-Received: by 2002:ac8:1485:: with SMTP id l5mr2494452qtj.281.1625278344554; Fri, 02 Jul 2021 19:12:24 -0700 (PDT) Received: from [192.168.1.201] (pool-74-96-87-9.washdc.fios.verizon.net. [74.96.87.9]) by smtp.googlemail.com with ESMTPSA id h2sm2248000qkf.106.2021.07.02.19.12.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Jul 2021 19:12:24 -0700 (PDT) From: Sean Anderson Subject: Re: [RFC PATCH 02/28] cli: Add LIL shell To: Wolfgang Denk Cc: u-boot@lists.denx.de, Tom Rini , =?UTF-8?Q?Marek_Beh=c3=ban?= , Simon Glass , Roland Gaudig , Heinrich Schuchardt , Kostas Michalopoulos References: <20210701061611.957918-1-seanga2@gmail.com> <20210701061611.957918-3-seanga2@gmail.com> <126700.1625223815@gemini.denx.de> Message-ID: <8bbdb7a1-5085-a3b7-614f-12ae9aee8e8b@gmail.com> Date: Fri, 2 Jul 2021 22:12:23 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 7/2/21 9:33 AM, Sean Anderson wrote: > On 7/2/21 7:03 AM, Wolfgang Denk wrote: >> Dear Sean, >> >> In message <20210701061611.957918-3-seanga2@gmail.com> you wrote: >>> This is the LIL programming language [1] as originally written by Kostas >>> Michalopoulos . LIL is a stripped-down TCL >>> variant. Many syntax features are very similar to shell: >> >> Do you have a list of the exact differencec between LIL and a >> standard shell? > > For a partial list, see > > [1] https://github.com/Forty-Bot/lil/commits/master Whoops, looks like I completely misread what you were asking here. I don't have an exhaustive list of differences, but here are some similar things expressed in both languages: sh tcl foo=bar set foo bar echo $foo echo $foo if [ 1 -gt 2 ]; then if {1 > 2} { echo a echo a else } { echo b echo b fi } foo() { proc foo {first second} { echo $1 $2 echo $first $second } } for file in $(ls *.c); do foreach file [glob *.c] { echo $file echo $file done } fact() { if [ $1 -eq 0 ]; then echo 1 else echo $(($1 * $(fact $(($1 - 1))))) fi } proc fact {n} { if {$n} { expr {$n * [fact [expr {$n - 1}]]} } { return 1 } } Hopefully this gives you a bit of a feel for the basic differences. --Sean > >> I wonder, if we deviate from standard shell syntax anyway, we could >> also have a look at lua, for example? > > I also looked at lua (see the cover letter), but I rejected it based on > size constraints (eLua was around the size of U-Boot itself). > > Because of how often the shell is used to debug things, I wanted the > candidate I picked to have similar syntax to the existing shell. For > example, > > load mmc ${mmcdev}:${mmcpart} $loadaddr $image > > is a valid command in both Hush and LIL. Compare with lua, which might > express the above as > > load("mmc", mmcdev .. ":" .. mmcpart, loadaddr, image) > > which I think is a much larger deviation from existing syntax. > > --Sean