[erlang-questions] sytax of atoms

Robert Virding robert.virding@REDACTED
Sun Apr 15 04:11:46 CEST 2007


As regular expressions for leex:

[a-z][A-Za-z0-9_-.]*
'(\\\^.|\\.|[^'])*'

With macros they're even shorter.

Robert


Caoyuan Deng wrote:
> 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 <dot@REDACTED> 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  <dot@REDACTED>  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
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 



More information about the erlang-questions mailing list