githwxi/ATS-Xanadu

Parsing error for block surrounded by curly braces

Closed this issue · 5 comments

Will there be support for blocks surrounded by curly braces (that is for blocks with void return type)?

For example:

implfun main0() = 
{
  val () = println!()
}

The error:

the_fxtyenv = 

[the_fixity_load] is finished.
the_basics_load: prelude/basics.sats
the_prelude_load: prelude/SATS/gbas.sats
synread_d0ecl: d0c0 = D0Cimpdecl(IMPLMNT(IMPfun); DECLMODnone(); ; ; DQ0EIDnone(I0DNTsome(IDENT_alp(main0))); ; F0ARGsome_dyn(D0Pparen(LPAREN; ; d0pat_RPAREN_cons0(RPAREN))); EFFS0EXPnone(); EQ; D0Esqarg(LBRACE; ; VAL(VLKval)))
synread_d0ecl: d0c0 = D0Cvaldecl(VAL(VLKval); DECLMODnone(); V0ALDECL@{, pat=D0Pparen(LPAREN; ; d0pat_RPAREN_cons0(RPAREN)), teq=EQ, def=D0Eapps(D0Eid(I0DNTsome(IDENT_alp(println))), D0Eid(I0DNTsome(IDENT_sym(!))), D0Eparen(LPAREN; ; d0exp_RPAREN_cons0(RPAREN))), wtp=WTHS0EXPnone()})
43(line=4, offs=1) -- 44(line=4, offs=2): SYNERR(d0ecl): RBRACE
synread_top: nxerr = 1
synread_top: there is one synerr!
exit(ATS): uncaught exception at run-time:
Xanadu/srcgen/xats/SATS/xerrory.sats:XATSOPT_SYNERR_EXN(1027)

The parser seems to be looking for quantifiers after encountering the opening brace.

My plan is to use { ... } for records in ATS3. For now, you can write:

implfun main0() =
let
  val () = println!()
end

I see, that makes sense. Though, wouldn't it be possible for us to optionally parse a list of dynamic declarations in the event that this list of static arguments is nil?

It is definitely doable. Still I would like to have a syntax design that is close to ML's if possible.

Ok. I see what you mean

Similar to

begin
...
end

in ocaml