-
-
Save otac0n/4338312 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>WebTurtle/Parser tests</title> | |
<meta charset="utf-8"> | |
<script language="javascript" SRC="js/peg-0.7.0.js"></script> | |
<script language="peg" id="grammar"> | |
start = wt program wt | |
program = front / back | |
front = 'μπροστά' wt integer | |
back = 'πίσω' integer | |
integer = digits:[0-9]+ { return parseInt(digits.join(''), 10); } | |
wt = [ \t\r\n]* | |
</script> | |
</head> | |
<body> | |
<script> | |
var parser = PEG.buildParser(document.getElementById("grammar").innerText); | |
result = parser.parse("μπροστά 10"); | |
document.write("<h1>Out with the old - in with the new!</h1>" ); | |
document.write(result); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment