[erlang-questions] sytax of atoms

Caoyuan Deng <>
Sat Apr 14 17:21:14 CEST 2007


There is an LALR-1 grammar definition similar to yacc:
lib/stdlib-1.14.4/src/erl_parse.yrl

And as I'm writing a Erlang IDE for NetBeans, I also wrote a LL(k)
grammar definition for Erlang:
http://erlybird.svn.sourceforge.net/viewvc/erlybird/trunk/erlybird/erlybird-erlang-editor/src/org/netbeans/modules/languages/erlang/Erlang.nbs?revision=96&view=markup

For the Atom, it's something like:
TOKEN:atom: (
    ["a"-"z"] ["a"-"z" "A"-"Z" "0"-"9" "_" "@"]* |
    "\'" ([^ "\\" "\'" "\n" "\r"] |
          ("\\" (. |
                 (["0"-"7"]) |
                 (["0"-"7"] ["0"-"7"]) |
                 (["0"-"7"] ["0"-"7"] ["0"-"7"])
                 ("^" ["@" "A"-"Z" "["-"_"])
                )
          )
    )*
    "\'"
)


On 4/14/07, Tony Finch <> wrote:
> The reference manual doesn't say that dots are permitted in atoms but they
> seem to be, e.g. in unquoted long node names.
>
> Is there a formal grammar (e.g. BNF) of Erlang anywhere?
>
> Tony.
> --
> f.a.n.finch  <>  http://dotat.at/
> HEBRIDES: SOUTH OR SOUTHEAST 4 OR 5, OCCASIONALLY 6 OR 7. MODERATE OR ROUGH.
> RAIN LATER. MODERATE OR GOOD.
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list