Related articles |
---|
YACC, Bison, lex, flex Modes for emacs hampton@ksu.edu (Tom Hampton) (1997-05-08) |
Re: YACC, Bison, lex, flex Modes for emacs sandro@lattice.latte.it (1997-05-13) |
Re: YACC, Bison, lex, flex Modes for emacs dan@unitech.com (Dan Harkless) (1997-05-15) |
Re: YACC, Bison, lex, flex Modes for emacs kelley@phys.ocean.dal.ca (1997-05-17) |
From: | sandro@lattice.latte.it (Sandro Sigala) |
Newsgroups: | comp.compilers |
Date: | 13 May 1997 22:39:51 -0400 |
Organization: | I.NET - Customers News Server |
References: | 97-05-122 |
Keywords: | tools, lex, yacc |
Tom Hampton wrote:
>After searching for a mode for the above, I found bison-mode.el which
>many of you have probably found as inadequate as I did. I am
>seriously considering writing Emacs major modes for the above
>languages.
For the YACC mode i might suggest a function that automagically formats the
grammar according to the specified user style (a la `set-c-style').
two example styles (widely used) may be:
-- 1 -----------------------------------
translation_unit:
/* epsilon */
| declaration_list
;
declaration_list:
declaration
| declaration_list declaration
;
-- 2 -----------------------------------
translation_unit
: /* epsilon */
| declaration_list
;
declaration_list
: declaration
| declaration_list declaration
;
----------------------------------------
The YACC mode might have a function to hide/show the action code written in
the grammar, i.e.:
- 1(hide) ------------------------------------
declaration_list:
declaration
{ ... }
| declaration_list declaration
{ ... }
;
- 2(show) ------------------------------------
declaration_list:
declaration
{ $$ = $1; /* ... */ }
| declaration_list declaration
{ $$ = link($1, $2); /* ...*/ }
;
----------------------------------------------
The YACC major-mode might also warn when a semicolon is missing
before saving.
----------------------
foo
: bar
| baz
<-------- like here
bar
: quux
;
---------------------
Just my Lit. 0.02.
Regards,
sandro
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.