Advertisement
Guest User

Ramon Snir

a guest
Jun 4th, 2010
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. %{
  2. open RSLispV3.RunTime
  3. %}
  4.  
  5. %start parse
  6. %token <string> Text
  7. %token <int> Digits
  8. %token Apostrophe Comma LeftParen RightParen Eof
  9. %type <Tim.Lisp.Core.LispVal list> parse
  10.  
  11. %%
  12.  
  13. Expr: Text { Text($1, 1) }
  14. | Apostrophe Text { Text($1, 0) }
  15. | Comma Text { Text($1, 2) }
  16. | Digits { Number $1 }
  17. | LeftParen RightParen { Null }
  18. | LeftParen Expr RightParen { List($2, 1, Null) }
  19. | Apostrophe LeftParen ExprList RightParen { List($2, 0, Null) }
  20. | Comma LeftParen ExprList RightParen { List($2, 2, Null) }
  21. | LeftParen Expr ExprList RightParen { List($2, 1, $3) }
  22. | Apostrophe LeftParen Expr ExprList RightParen { List($2, 0, $3) }
  23. | Comma LeftParen Expr ExprList RightParen { List($2, 2, $3) }
  24.  
  25. ExprList: Expr { List($1, -1, Null) ] }
  26. | Expr ExprList { List($1, -1, $2) }
  27.  
  28. parse: ExprList Eof { $1 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement