Skip to content

Instantly share code, notes, and snippets.

View Alaya-in-Matrix's full-sized avatar

Wenlong Lyu Alaya-in-Matrix

  • Huawei Noah's Ark Lab
  • China,Shanghai
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Alaya-in-Matrix
Alaya-in-Matrix / expr.hs
Last active August 29, 2015 14:27
Simple interpreter for +-*/()
{-# language OverloadedStrings #-}
module Main where
-- Author: lvwenlong_lambda@qq.com
-- Last Modified:CST 2015-08-20 14:01:07 星期四
import Text.ParserCombinators.Parsec
import Control.Applicative hiding((<|>))
import Data.String
data Expr = Add Expr Expr2 | Sub Expr Expr2 | E2 Expr2
data Expr2 = Mul Expr2 Expr3 | Div Expr2 Expr3 | E3 Expr3
data Expr3 = Quote Expr | NumLit Int