[erlang-questions] Problem parsing Erlang code

Kostis Sagonas <>
Tue Nov 20 18:27:21 CET 2007


Joel Reymont wrote:
> 
> I tried the following at the Erlang prompt but got an error. Any  
> suggestions?

You've not understood that Erlang clauses cannot be parsed on their own 
(i.e. without being part of a function definition) because the parser 
needs to read until it finds a "."

Change the ";" to "." and it will work.

Kostis

> ---
> 
> S = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4,  
> \"bicycling, <10\");".
> {ok, Toks, _} = erl_scan:string(S).
> {ok, AbsForm} = erl_parse:parse(Toks).
> 
> =ERROR REPORT==== 20-Nov-2007::17:00:03 ===
> Error in process <0.31.0> with exit value: {{badmatch,{error, 
> {999999,erl_parse,["syntax error before: ",[]]}}},[{erl_eval,expr,3}]}



More information about the erlang-questions mailing list