ssm-lang / sslang

A language built atop the Sparse Synchronous Model
BSD 3-Clause "New" or "Revised" License
18 stars 0 forks source link

blank line or comment at top of .ssl file fails #79

Closed EmilySillars closed 2 years ago

EmilySillars commented 2 years ago

When writing a SSLANG source program, if I leave a blank line at the top of the file or try to make a comment the first line in the file, the compiler throws a parsing error. Below is an example of this behavior. Example program:

// a comment here
type Tree
  TwoChildren Tree Tree  
  Leaf                   
  OneChild Int Tree

main ( cout : & Int ) -> () =
  let d = Leaf 
  let zzz = match d 
                  Leaf = 65
                  _ = 66

// correct output should be 65 'A'
  after 10 , (cout : & Int) <- zzz
  wait (cout : & Int)

Error ouput from runtests.log:

###### Testing comment--first-line
stack exec sslc -- tests/comment--first-line.ssl > out/comment--first-line.c
ParseError (ErrorMsg "at Token (Span {tokPos = 18, tokLen = 0, tokLine = 2, tokCol = 1},TDBar)")
###### FAILED

This is likely a very simple fix, but I haven't had time to investigate it deeply yet so I am documenting it here for now.