forked from glen/fostr
parent
bfe3f86116
commit
d2ba26a53e
@ -39,6 +39,7 @@ context-free syntax
|
|||||||
|
|
||||||
Ex.Int = INT
|
Ex.Int = INT
|
||||||
Ex.LitString = STRING_LITERAL
|
Ex.LitString = STRING_LITERAL
|
||||||
|
Ex.EscString = STRING
|
||||||
Ex.Stream = <stream>
|
Ex.Stream = <stream>
|
||||||
Ex.Sum = <<Ex> + <Ex>> {left}
|
Ex.Sum = <<Ex> + <Ex>> {left}
|
||||||
Ex.Gets = [[Ex] << [Ex]] {left}
|
Ex.Gets = [[Ex] << [Ex]] {left}
|
||||||
|
1
tests/hw2.fos
Normal file
1
tests/hw2.fos
Normal file
@ -0,0 +1 @@
|
|||||||
|
<<< "Hello,\t\tworld!\n\n"
|
@ -39,6 +39,7 @@ rules
|
|||||||
hs: (_, Stream()) -> "StdIO"
|
hs: (_, Stream()) -> "StdIO"
|
||||||
hs: (_, Int(x)) -> x
|
hs: (_, Int(x)) -> x
|
||||||
hs: (_, LitString(x)) -> <haskLitString>x
|
hs: (_, LitString(x)) -> <haskLitString>x
|
||||||
|
hs: (_, EscString(x)) -> x
|
||||||
hs: (_, Sum(x, y)) -> $[([x] + [y])]
|
hs: (_, Sum(x, y)) -> $[([x] + [y])]
|
||||||
|
|
||||||
hs: (Gets(_, xn), Gets(s, x)) -> v
|
hs: (Gets(_, xn), Gets(s, x)) -> v
|
||||||
|
@ -17,6 +17,7 @@ rules
|
|||||||
js: Stream() -> $[Stdio]
|
js: Stream() -> $[Stdio]
|
||||||
js: Int(x) -> x
|
js: Int(x) -> x
|
||||||
js: LitString(x) -> <javaLitString>x
|
js: LitString(x) -> <javaLitString>x
|
||||||
|
js: EscString(x) -> x
|
||||||
js: Sum(x,y) -> $[[x] + [y]]
|
js: Sum(x,y) -> $[[x] + [y]]
|
||||||
js: Gets(x, y) -> $[[x].gets([y])]
|
js: Gets(x, y) -> $[[x].gets([y])]
|
||||||
js: To(x, y) -> $[to([x],[y])]
|
js: To(x, y) -> $[to([x],[y])]
|
||||||
|
@ -19,6 +19,7 @@ rules
|
|||||||
py: Stream() -> $[Stdio]
|
py: Stream() -> $[Stdio]
|
||||||
py: Int(x) -> x
|
py: Int(x) -> x
|
||||||
py: LitString(x) -> $[r[x]]
|
py: LitString(x) -> $[r[x]]
|
||||||
|
py: EscString(x) -> x
|
||||||
py: Sum(x,y) -> $[[x] + [y]]
|
py: Sum(x,y) -> $[[x] + [y]]
|
||||||
py: Gets(x, y) -> $[[x].gets([y])]
|
py: Gets(x, y) -> $[[x].gets([y])]
|
||||||
py: To(x, y) -> $[to([x],[y])]
|
py: To(x, y) -> $[to([x],[y])]
|
||||||
|
@ -184,16 +184,19 @@ constructor was trivial:
|
|||||||
|
|
||||||
Now typing literals is straightforward:
|
Now typing literals is straightforward:
|
||||||
```statix
|
```statix
|
||||||
|
{! "\git docs/statix_works:trans/statics.stx" extract:
|
||||||
|
start: '(.*ty_Ex.Int.*\s*)'
|
||||||
|
stop: '/. ../'
|
||||||
|
!}
|
||||||
|
```
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/** md */
|
|
||||||
ty_Ex(Int(_)) = INT().
|
ty_Ex(Int(_)) = INT().
|
||||||
ty_Ex(LitString(_)) = STRING().
|
ty_Ex(LitString(_)) = STRING().
|
||||||
|
ty_Ex(EscString(_)) = STRING().
|
||||||
ty_Ex(e@Stream()) = STREAM().
|
ty_Ex(e@Stream()) = STREAM().
|
||||||
/* **/
|
|
||||||
|
|
||||||
/** md
|
/** md
|
||||||
```
|
|
||||||
|
|
||||||
Finally we get to the binary operators, and here we use the pattern found in
|
Finally we get to the binary operators, and here we use the pattern found in
|
||||||
recent versions of the
|
recent versions of the
|
||||||
|
Loading…
Reference in New Issue
Block a user