[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Documentation patch
From: |
Akim Demaille |
Subject: |
Re: Documentation patch |
Date: |
09 Aug 2001 12:56:01 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor) |
| Hi!
| Here is another patch for the bison manual. I've made some changes to the
| location part, but there's no example yet in the tutorial chapter.
OK. Pease, install.
| And, Akim, it seems that bison.simple still uses the old YYLLOC_DEFAULT
| macro.
Bummer. I must have missed something.
I leave this to you, TIA :) Oh, btw, don't forget to 2001 the header
comment.
| Though grammar rules and semantic actions are enough to write a fully
| functional parser, it can be useful to process some additionnal informations,
| -especially locations of tokens and groupings.
| +especially symbol locations.
| +
| address@hidden (terminal or not) ?
If `symbol' was clearly defined before, we don't need to recall it.
| +With this default action, the location tracking can be fully automatic. The
Maybe you shouldn't use `default action', which already has a fairly
specific meaning in the current context.
| +example above simply rewrites this way:
| +
| address@hidden
| address@hidden
| +exp: @dots{}
| + | exp '/' exp
| + @{
| + if ($3)
| + $$ = $1 / $3;
| + else
| + @{
| + $$ = 1;
| + printf("Division by zero, l%d,c%d-l%d,c%d",
| + @@3.first_line, @@3.first_column,
| + @@3.last_line, @@3.last_column);
| + @}
| + @}
| address@hidden group
| address@hidden example
Be sure not to go to much to the right: check that `make dvi' makes it
fit properly. I would promote
exp:
@dots{}
| exp '/' exp
@{
if ($3)
$$ = $1 / $3;
else
@{
$$ = 1;
printf("Division by zero, l%d,c%d-l%d,c%d",
@@3.first_line, @@3.first_column,
@@3.last_line, @@3.last_column);
@}
@}
Again, that's great job, thanks!