Compare commits

..

No commits in common. "d4303606dfccfc32762172a49a46d0e37e0f942c" and "f3d37076ee203a16ad0f1555fd606fff87748d8f" have entirely different histories.

2 changed files with 5 additions and 11 deletions

View File

@ -9,17 +9,18 @@
<div id="elm-container"> <div id="elm-container">
</div> </div>
<script> <script>
var program = `move(0, 0); var program = `
move(0, 0);
define line(x1, y1, x2, y2) { define line(x1, y1, x2, y2) {
pen up; pen up;
move(x1, y1); move(x1, y1);
pen down; pen down;
move(x2, y2); move(x2, y2);
} };
define nix(x, y, width, height) { define nix(x, y, width, height) {
call line (x, y, x + width, y + height); call line (x, y, x + width, y + height);
call line (x + width, y, x, y + height); call line (x + width, y, x, y + height);
} };
call nix(0, 0, 20, 20); call nix(0, 0, 20, 20);
` `
var container = document.getElementById("elm-container"); var container = document.getElementById("elm-container");

View File

@ -90,7 +90,7 @@ parseExpr = oneOf [ lazy (\_ -> backtrackable parseSum), parseTerm ]
parseProg : Parser LogoProg parseProg : Parser LogoProg
parseProg = sequence parseProg = sequence
{ start = "" { start = ""
, separator = "" , separator = ";"
, end = "" , end = ""
, spaces = spaces , spaces = spaces
, item = lazy (\_ -> parseCmd) , item = lazy (\_ -> parseCmd)
@ -135,8 +135,6 @@ parseCall = succeed Call
, item = parseExpr , item = parseExpr
, trailing = Forbidden , trailing = Forbidden
} }
|. spaces
|. symbol ";"
parsePenMode : Parser LogoPenMode parsePenMode : Parser LogoPenMode
parsePenMode = oneOf parsePenMode = oneOf
@ -149,8 +147,6 @@ parsePen = succeed Pen
|. keyword "pen" |. keyword "pen"
|. spaces |. spaces
|= parsePenMode |= parsePenMode
|. spaces
|. symbol ";"
parseMove : Parser LogoCmd parseMove : Parser LogoCmd
parseMove = succeed Move parseMove = succeed Move
@ -162,10 +158,7 @@ parseMove = succeed Move
|. symbol "," |. symbol ","
|. spaces |. spaces
|= parseExpr |= parseExpr
|. spaces
|. symbol ")" |. symbol ")"
|. spaces
|. symbol ";"
{- {-
======= Semantics Code ======= ======= Semantics Code =======