diff --git a/syntax/fostr.sdf3 b/syntax/fostr.sdf3 index c346eee..8624b58 100644 --- a/syntax/fostr.sdf3 +++ b/syntax/fostr.sdf3 @@ -39,6 +39,7 @@ context-free syntax Ex.Int = INT Ex.LitString = STRING_LITERAL + Ex.EscString = STRING Ex.Stream = Ex.Sum = < + > {left} Ex.Gets = [[Ex] << [Ex]] {left} diff --git a/tests/hw2.fos b/tests/hw2.fos new file mode 100644 index 0000000..c177d31 --- /dev/null +++ b/tests/hw2.fos @@ -0,0 +1 @@ +<<< "Hello,\t\tworld!\n\n" diff --git a/trans/haskell.str b/trans/haskell.str index fc75a7b..0e26050 100644 --- a/trans/haskell.str +++ b/trans/haskell.str @@ -39,6 +39,7 @@ rules hs: (_, Stream()) -> "StdIO" hs: (_, Int(x)) -> x hs: (_, LitString(x)) -> x + hs: (_, EscString(x)) -> x hs: (_, Sum(x, y)) -> $[([x] + [y])] hs: (Gets(_, xn), Gets(s, x)) -> v diff --git a/trans/javascript.str b/trans/javascript.str index 1fd2900..3a847e2 100644 --- a/trans/javascript.str +++ b/trans/javascript.str @@ -17,6 +17,7 @@ rules js: Stream() -> $[Stdio] js: Int(x) -> x js: LitString(x) -> x + js: EscString(x) -> x js: Sum(x,y) -> $[[x] + [y]] js: Gets(x, y) -> $[[x].gets([y])] js: To(x, y) -> $[to([x],[y])] diff --git a/trans/python.str b/trans/python.str index 068f05a..6449417 100644 --- a/trans/python.str +++ b/trans/python.str @@ -19,6 +19,7 @@ rules py: Stream() -> $[Stdio] py: Int(x) -> x py: LitString(x) -> $[r[x]] + py: EscString(x) -> x py: Sum(x,y) -> $[[x] + [y]] py: Gets(x, y) -> $[[x].gets([y])] py: To(x, y) -> $[to([x],[y])] diff --git a/trans/statics.stx b/trans/statics.stx index ef63c8d..340a1df 100644 --- a/trans/statics.stx +++ b/trans/statics.stx @@ -184,16 +184,19 @@ constructor was trivial: Now typing literals is straightforward: ```statix +{! "\git docs/statix_works:trans/statics.stx" extract: + start: '(.*ty_Ex.Int.*\s*)' + stop: '/. ../' +!} +``` **/ - /** md */ ty_Ex(Int(_)) = INT(). ty_Ex(LitString(_)) = STRING(). + ty_Ex(EscString(_)) = STRING(). ty_Ex(e@Stream()) = STREAM(). - /* **/ /** md -``` Finally we get to the binary operators, and here we use the pattern found in recent versions of the