feat: Add syntax for string literals
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Also rudimentary code generation. The difficulty is that for Haskell generation, we need to know whether an expression is a string or in to send it to standard output. So we will need to begin implementation of a type system for fostr.
This commit is contained in:
parent
c516ed6d7f
commit
904f651897
5 changed files with 39 additions and 6 deletions
|
@ -8,6 +8,14 @@ context-free start-symbols
|
|||
|
||||
Start
|
||||
|
||||
lexical sorts
|
||||
|
||||
STRING_LITERAL
|
||||
|
||||
lexical syntax
|
||||
|
||||
STRING_LITERAL = ~[\']*
|
||||
|
||||
context-free sorts
|
||||
|
||||
Start LineSeq Line OptTermEx TermExLst TermEx Ex
|
||||
|
@ -29,13 +37,14 @@ context-free syntax
|
|||
|
||||
TermEx.Terminate = <<Ex>;>
|
||||
|
||||
Ex.Int = INT
|
||||
Ex.Stream = <stream>
|
||||
Ex.Sum = [[Ex] + [Ex]] {left}
|
||||
Ex.Gets = [[Ex] << [Ex]] {left}
|
||||
Ex.To = [[Ex] >> [Ex]] {left}
|
||||
Ex.Int = INT
|
||||
Ex.LitString = <'<STRING_LITERAL>'>
|
||||
Ex.Stream = <stream>
|
||||
Ex.Sum = <<Ex> + <Ex>> {left}
|
||||
Ex.Gets = [[Ex] << [Ex]] {left}
|
||||
Ex.To = [[Ex] >> [Ex]] {left}
|
||||
|
||||
Ex = <(<Ex>)> {bracket}
|
||||
Ex = <(<Ex>)> {bracket}
|
||||
|
||||
context-free priorities
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue