[erlang-questions] some lexical questions

Joe Armstrong erlang@REDACTED
Tue Jul 13 09:13:00 CEST 2010


On Tue, Jul 13, 2010 at 1:22 AM, Richard O'Keefe <ok@REDACTED> wrote:
>
> On Jul 13, 2010, at 2:10 AM, Joe Armstrong wrote:
>>
>> 1) Is there a "definitive" reference for the meaning of the
>> allowed escape sequences within a string?
>
> I would expect \^ to allow any of the ASCII characters
> in the range 16#3F to 16#5F after it ($? to $_) with the
> meaning \^x = ($x - 16#40) band 127, so that
> \^? is DEL, \^@ is NUL, \^L if FF, \^Z is SUB, \^_ is US.
> And in particular, \^[ should be ESC.
>
>> This seems far easier to understand than a yacc or LL(k) grammar :-)
>
> Since it's for lexical structure, it should be simpler;
> the right comparison would be with lex.
>
> (And it's not _really_ a fair comparison until there's some
> semantics in there.)  Come to think of it, where does that
> grammar recognise any of (,)[|]{;} or any operator?
>

I only showed the lexical part of the grammar. In fact I have two grammars
one for the tokens (which I showed) the other (which I did not show) has
productions like

   list <- '[' ']' / '[' term (',' term)* ']'
   ...

all the non-terminals in the second grammar are added to the first grammar
to build a recognizer - but I didn't show this step.

I'm trying to build something like ANTLR with parser combinators

/Joe


More information about the erlang-questions mailing list