[ADMB Users] ADMB keywords
John Sibert
sibert at hawaii.edu
Tue Apr 20 10:54:44 PDT 2010
Speaking of ADMB syntax highlighting,
http://admb-project.org/community/editing-tools/vim hosts tools to
highlight ADMB syntax using vim. It extends the usual vim C++
highlighting so that SECTIONs appear as C++ keywords and ADMB types (and
many AUTODIF types) appear as C++ types. The syntax file was generated
by processing the tpl2rem.lex (and tpl2cpp.lex) file with an awk script,
vimsyntax.sh, available at
http://code.google.com/p/admb-project/source/browse/trunk/scripts/vimsyntax.sh.
Using a script to automatically generate such lists seems like a simple
way to keep the lists consistent with the the code. (Oddly the .lex
files don't seem to be anywhere on
http://code.google.com/p/admb-project/source/browse/trunk )
You can do anything with awk and sed.
Cheers,
John
Arni Magnusson wrote:
> The La Jolla report
> (http://admb-project.org/community/admb-meeting-march-29-31/ADMBMeetingReportv3.pdf/at_download/file,
> page 1) mentions a list of commonly used functions and other keywords
> used in ADMB models.
>
> I have just uploaded this list to the ADMB Project website
> (http://admb-project.org/documentation/api/keywords.txt/view), as well
> as the R function used to generate the list
> (http://admb-project.org/documentation/api/getKeywords.R/at_download/file).
>
>
> The original purpose of this list is to highlight code in Emacs
> admb-mode, and later in ADMB-IDE. Whenever I see a new ADMB model, I
> open it in Emacs and check that functions, variable types, etc. are
> properly highlighted. The same list can serve other purposes:
>
> 1. Doxygen documentation
> (http://admb-project.org/documentation/draft-api-documentation) should
> probably focus on these keywords to start with, since they are the
> most likely to be looked up by users.
>
> 2. Other documentation (manuals, reference sheets, etc.) should list
> those functions, variable types, etc. They already do in most cases,
> but not all.
>
> 3. Other editors can use the same list for highlighting ADMB syntax.
>
> Any feedback on the keyword list and syntax highlighting is
> appreciated. Ian Taylor once mentioned that an XML keyword list would
> be useful, on which all editors could base their syntax highlighting.
> The combination of admb.el and getKeywords.R can probably serve that
> purpose.
>
> ---
>
> That is the top-down approach, based on available ADMB models. The
> bottom-up approach is also worth considering, sifting keywords from
> admb/include/fvar.hpp, admb/include/admodel.h, and the like.
>
> Some users are already following the bottom-up approach. A colleague
> of mine needed a 3d array of integers in his ADMB model the other day,
> and asked me if the i3_array class is intended for users. He also
> wanted to know if it can be declared in the DATA_SECTION, or if it
> must be declared in the GLOBALS_SECTION to make it available to
> functions. I told him I didn't know. The i3_array is mentioned in the
> MULTIFAN manual, but not in the ADMB or AUTODIF manuals.
>
> At any rate, the admb.el keyword list will continue to grow, and may
> benefit from some restructuring, or improving the somewhat arbitrary
> labels and grouping. The goal was to apply colors to improve code
> legibility, rather than analyzing the language. The result is a
> hodgepodge of C, C++, AUTODIF, ADMB, and ADMB-RE, but I avoided
> getting into compiler specifics.
>
> Arni
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
>
--
John Sibert
Emeritus Researcher, SOEST
University of Hawaii at Manoa
Visit the ADMB project http://admb-project.org/
More information about the Users
mailing list