From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Adding wc to Bournish Date: Thu, 23 Jun 2016 10:34:04 +0200 Message-ID: <87twgkqp6r.fsf@gnu.org> References: <20160524184720.GA27449@debian-netbook> <20160605124033.GB859@debian-netbook> <87eg8bpe2v.fsf@gnu.org> <20160607074155.GB32264@debian-netbook> <878tyfelf6.fsf@gnu.org> <20160614092713.GA2832@debian-netbook> <20160614102029.GB10636@debian-netbook> <20160614105037.GC10636@debian-netbook> <87shwed084.fsf@gnu.org> <20160615202814.GB25828@debian-netbook> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG05l-0004Wk-Dm for guix-devel@gnu.org; Thu, 23 Jun 2016 04:34:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bG05f-000196-P5 for guix-devel@gnu.org; Thu, 23 Jun 2016 04:34:28 -0400 In-Reply-To: <20160615202814.GB25828@debian-netbook> (Efraim Flashner's message of "Wed, 15 Jun 2016 23:28:14 +0300") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Efraim Flashner Cc: guix-devel@gnu.org, David Thompson Hello! Efraim Flashner skribis: [...] >> I prefer the approach Ricardo suggested, I think it=E2=80=99s more conci= se and >> clearer: >>=20 >> https://lists.gnu.org/archive/html/guix-devel/2016-06/msg00525.html >>=20 >> Also, note that @@ would not be needed here; @@ serves to access private >> bindings within a specific module: >>=20 >> https://www.gnu.org/software/guile/manual/html_node/Using-Guile-Module= s.html >>=20 >> Last, do not miss the bit about docstrings at: >>=20 >> https://www.gnu.org/software/guix/manual/html_node/Formatting-Code.html >>=20 >> :-) >>=20 >> With these changes, we=E2=80=99re all set. Thanks! > > I've attached another patch Sorry for taking so long! I=E2=80=99ve applied the patch with minor cosmet= ic changes: procedure names, docstrings, and formatting (please take a look). >> From a GSoC viewpoint, I think we must move to the compilation part >> now. Specifically, I think the next step is to start parsing Bash >> code. > > This part took much longer than I thought it would. Going forward I'll > try to be more pro-active on IRC about asking for help. > >>=20 >> For that we could use SILex + parse-lalr, but these are not the nicest >> tools for the job. Better tools would be =E2=80=9Cparsing expression gr= ammars=E2=80=9D >> (the (ice-9 peg) module in Guile 2.1) or parser combinators, though I >> don=E2=80=99t think there=E2=80=99s a directly usable Guile library for = that. Maybe >> Eric or David can comment? >>=20 > > I get lalr as look-ahead left->right parser and found this=C2=B9, but wha= t's SILex? SILex is a lexer: it turns character sequences into tokens, that can then be passed to the parser. I think SILex no longer has a home on the Internet, but you can find a copy at . Guile-RPC uses both SILex and =E2=80=98parse-lalr=E2=80=99, so it could ser= ve as an example, but again, PEG is probably preferable (Dave=E2=80=99s guile-parser-combinator library is not ready for prime time, per a recent discussion on guile-user@gnu.org.) >> The goal is to have a parser that returns an abstract syntax tree (AST) >> as an sexp: >>=20 >> (parse "(cd /foo; ls $HOME) && echo *.a ; echo done") >> =3D> >> '(sequence >> (success-sequence >> (subshell >> (sequence (command "cd" "/foo") >> (command "ls" (variable-ref "HOME")))) >> (command "echo" (glob "*.a"))) >> (command "echo" "done")) >>=20 >> Thoughts? So let=E2=80=99s focus on this part now. Feel free to ping me/us while researching the best approach or tools to work on it! Thanks, Ludo=E2=80=99.