From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EBuXb-000666-JG for mharc-grub-devel@gnu.org; Sun, 04 Sep 2005 09:28:11 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EBuXZ-00065V-7B for grub-devel@gnu.org; Sun, 04 Sep 2005 09:28:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EBuXY-00064x-7q for grub-devel@gnu.org; Sun, 04 Sep 2005 09:28:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EBuXY-00064n-5E for grub-devel@gnu.org; Sun, 04 Sep 2005 09:28:08 -0400 Received: from [64.233.184.203] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EBuWE-00021S-D0 for grub-devel@gnu.org; Sun, 04 Sep 2005 09:26:46 -0400 Received: by wproxy.gmail.com with SMTP id i6so815233wra for ; Sun, 04 Sep 2005 06:23:07 -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=nUp33JS5NG9reO5G1vvDkBQDVhEGOigWVpbPaVTcsWVYZ12NjKBbIYqV9gZYELfZCNunMxkqSmP765gQeWj3GLr3cyOmiewzvpj/4RAn9Xxl+hQcjmvnXHxJ1petRd+de5b+9qTwVPbb+i8Bpop8SnJOU8tUOD+cJBOOH57HrXI= Received: by 10.54.133.17 with SMTP id g17mr3581946wrd; Sun, 04 Sep 2005 06:23:07 -0700 (PDT) Received: from ?192.168.1.100? ( [83.77.13.181]) by mx.gmail.com with ESMTP id 12sm4037926wrl.2005.09.04.06.23.05; Sun, 04 Sep 2005 06:23:07 -0700 (PDT) Message-ID: <431AF535.5040405@gmail.com> Date: Sun, 04 Sep 2005 15:23:01 +0200 From: Vladimir Serbinenko User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: The development of GRUB 2 References: <42FF0C53.1070601@gmail.com> <200508141635.29675.okuji@enbug.org> <42FF6B6D.4050403@gmail.com> <200508142001.25893.okuji@enbug.org> <42FF8DB7.10700@gmail.com> <87vf27xfsq.fsf@student.han.nl> <430C3FA4.308@gmail.com> <871x49ud1d.fsf@student.han.nl> In-Reply-To: <871x49ud1d.fsf@student.han.nl> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Patch] Scripting engine 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: Sun, 04 Sep 2005 13:28:09 -0000 Marco Gerards wrote: > >Can't this be done in the same bison parser? Or what do you mean? > > I don't think so. Even the tokenization is very differetn. Ex: 2+3*5 is one token for normal parsing, but five for arithmethic and yylex knows nothing about what parsing is now. If it would always issue 5 tokens it would be impossible to difference 2+3*5 and 2 + 3 * 5 And yylex normally must not issue the space - it would make bison parser too complicated >I noticed that you have hand written yylex, wouldn't it be a lot >easier to use flex for this? In that case you can easily detect >tokens using regular expressions. This makes maintaining the >tokenizer really easy. > > For bash regular expression is not really needed. There are only 3 types of tokens: reserved words (if, ...), normal words (WORD) and command separators (; and ENTER). All token except WORD could be easily recognized by simple comparing (check_for_keyword function). But WORD needs special treatment because its value is partially unknown that's why I use superchar structure (it keeps known parts as well as necessary information to determine the value of unknown parts) Vladimir