Gentoo Archives: gentoo-soc

From: Luca Barbato <lu_zero@g.o>
To: gentoo-soc@l.g.o
Cc: Nathan Eloe <powerofazure@×××××.com>
Subject: Re: [gentoo-soc] libbash Weekly Update
Date: Tue, 20 Jul 2010 10:34:35
Message-Id: 4C457BAA.4090708@gentoo.org
In Reply to: [gentoo-soc] libbash Weekly Update by Nathan Eloe
1 On 07/19/2010 05:46 PM, Nathan Eloe wrote:
2 > I've had a productive week overall, with lots of good progress towards
3 > the final goal of this project.
4 >
5 > As the grammar becomes finalized, a change must be made. All of the
6 > debugging tools are used for grammars that output Java code, but I want
7 > a C/C++ library to handle everything. So this meant the following things:
8 > 1) Grammar file had to work regardless of what the output language was.
9 > 2) I needed to know just how the C runtime worked for ANTLR.
10 > 3) Since I'm starting to write library code (not just a grammar in a
11 > fancy IDE) I need to document my coding standards for any C/C++ code
12 > written over the next half of the project.
13 >
14 > And that indeed is what I've done. I now have coding style guidelines
15 > (which can be found at http://web.mst.edu/~nwe5g8/coding_standard.pdf,
16 > though as changes are made to the .tex file in the repository, the
17 > guaranteed up to date version of the guidelines can be generated from that).
18 >
19 > Also, I've written a quick sample program that parses a single ebuild.
20 > This is mostly a proof of concept, not a final product. All I was
21 > trying to do was get familiar with the C runtime and see how it worked.
22 >
23 > In a previous email I wrote about "infinite loops" in the parser, or at
24 > least loops that I was too impatient to wait to finish (5 minutes is too
25 > long to wait for a parser to finish parsing something). I found the
26 > problem: I was attempting to recursively aggregate complex strings in
27 > the parser, and the backtracking became too complex for it to handle.
28 > So, I removed the aggregation step, instead just showing the individual
29 > portions of the strings. Aggregation will be handled by the C++
30 > implementation (which has to do other things with variable expansions in
31 > strings, etc). So that was a major problem solved, and it tuned the
32 > performance of the parser quite nicely.
33 >
34 > The last thing I needed to do was get a language agnostic grammar. C++
35 > already has functions like exp, and bitor, bitxor, and bitand are C++
36 > keywords. The runtime doesn't do anything to fix/catch any of this. As
37 > such I had to go back and do that manually. However, the changes I made
38 > seemed to make it a grammar that was easier to read.
39 >
40 >
41 > This week is mostly setup and input. I'm writing a big bash script that
42 > demonstrates all the features that the grammar supports, and will be
43 > sending the resulting AST to the bash upstream mailing list and the
44 > portage_devs mailing list to see if they have suggestions. I'm also
45 > going to scour man bash for missing features, set up the build system
46 > for the libbash portion of the code (most likely cmake), Implement a
47 > very simple bash builtin (echo), and finally implement a symbol table.
48 > A busy week, but a week that should leave me in excellent shape for the
49 > rest of the project.
50
51 If it has to be used in portage please:
52
53 - use autotools or ask for help about using them.
54 - consider staying on plain C as much as possible, breakage in C++
55 software because of tiny differences in the stdc++ runtime are a
56 constant and portage must survive them.
57
58 lu
59
60 --
61
62 Luca Barbato
63 Gentoo/linux
64 http://dev.gentoo.org/~lu_zero

Replies

Subject Author
Re: [gentoo-soc] libbash Weekly Update Fabian Groffen <grobian@g.o>