From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1ETLR1-0001oE-PI for mharc-grub-devel@gnu.org; Sat, 22 Oct 2005 11:37:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ETLQz-0001nd-J1 for grub-devel@gnu.org; Sat, 22 Oct 2005 11:37:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ETLQy-0001n7-Dz for grub-devel@gnu.org; Sat, 22 Oct 2005 11:37:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ETLQy-0001mp-0l for grub-devel@gnu.org; Sat, 22 Oct 2005 11:37:24 -0400 Received: from [64.233.184.200] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ETLQx-0001gO-Tn for grub-devel@gnu.org; Sat, 22 Oct 2005 11:37:24 -0400 Received: by wproxy.gmail.com with SMTP id 71so372575wri for ; Sat, 22 Oct 2005 08:37:22 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:disposition-notification-to:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=ajMzVVpQa6G94KLugryuhoOYi8j3WvkCv2kQY3zFMDFaI4LdqYbwu6Jo0VLRPq5tvY6OGuRCKGy7iMN6VLjajoMsHRTgR2NtoNfbDZoMQjUCvStdyBDxrvVZ2R818uLvYwmhgOdKHW2tQgvFUrNDc6jI84sL5/46LG+aJbk6KPw= Received: by 10.54.84.5 with SMTP id h5mr2033037wrb; Sat, 22 Oct 2005 08:37:22 -0700 (PDT) Received: from ?192.168.1.100? ( [83.76.227.245]) by mx.gmail.com with ESMTP id 16sm1787097wrl.2005.10.22.08.37.21; Sat, 22 Oct 2005 08:37:22 -0700 (PDT) Message-ID: <435A5CAF.40103@gmail.com> Date: Sat, 22 Oct 2005 17:37:19 +0200 From: Vladimir Serbinenko User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050804) X-Accept-Language: en-us, en MIME-Version: 1.0 To: The development of GRUB 2 References: <87pspxtzyu.fsf@student.han.nl> <435A50BE.5030801@gmail.com> <87hdb9twr9.fsf@student.han.nl> In-Reply-To: <87hdb9twr9.fsf@student.han.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Scripting support X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2005 15:37:26 -0000 Hello > > > >>In bash when you define a function it appears under environment >>variables. IMHO it's useless to store completely the source code as an >>environment variables. I propose that the functions will be preparsed >>(converted to internal format ready for execution) because it will >>gretelya simplify lexer and parser >> >> > >Right. We should discuss the internal format on the list, I think. > > > >Right. And this can be kept quite simple. The commands itself are >just a string of text. The loops just check a variable, no? It can >be something like: > >for foo in 1 2 3 > do > echo $i > done > >That can be translated into some kind of pseudo language: > >1: list = 1 2 3 >2: read i, list >3: echo $i >4: check list >5: je 2 > >I know it's stupid and kind of silly like this. But we have to define >a language. It's important to discuss this on the list, IMO. > > > I thought about (a): 1: command=forin variable=i list=1 2 3 end=NULL /* it will be 4 if script continues*/ 2: echo $i 3: jump 1 Or (b): 1:splitpush 1 2 3 2:pop list 3:read i, list 4:push list 5:echo $i 6:pop list 7:check list 8:push list 9:je 2 10:pop list The question is how many commands to make: a lot (like in a where nearly every internal command corresponds to a scripting command) or make so few commands as possible. I wonder which approach is better (it's question about bugs and readibility, of course, not about speed) >Which mail are you talking about (subject and date)? I must have >missed a few the last months. :-( > > Re: [Patch] Scripting engine 25.09.2005 [Patch] Scripting engine 24.08.2005 It's just demonstration of some ideas. Now I think with new splitter it would be better to keep arglist unparsed. In this patch it was that if we have echo 1 2 3\;\$ ab$i; lexer returns (schematically) STRING(echo) STRING(1) STRING(2) STRING (3;$) STRING(abVAR(i)) SEMICOLON now I would do that it returns: STRING(echo 1 2 3\;\$ ab$i) SEMICOLON Vladimir 'phcoder' Serbinenko