1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

Merge branch 'master' into garbage-collecting

This commit is contained in:
Rob Rix 2018-03-14 09:39:55 -04:00
commit 6918fb31cf
152 changed files with 1016 additions and 1959 deletions

View File

@ -160,6 +160,7 @@ library
, recursion-schemes
, reducers
, scientific
, semigroupoids
, split
, stm-chans
, template-haskell

View File

@ -14,6 +14,7 @@ import Control.Monad.Effect.Reader
import Control.Monad.Effect.State
import Data.Abstract.Configuration
import Data.Abstract.Evaluatable
import Data.Abstract.Address
import Data.Abstract.ModuleTable
import Data.Abstract.Value
import Data.Blob
@ -25,28 +26,30 @@ import Prologue
import System.FilePath.Posix
-- | Evaluate a term to a value.
evaluate :: forall value term
. ( Evaluatable (Base term)
evaluate :: forall value term effects
. ( effects ~ RequiredEffects term value (Evaluating term value effects)
, Evaluatable (Base term)
, FreeVariables term
, MonadAddressable (LocationFor value) value (Evaluating term value (EvaluatingEffects term value))
, MonadValue term value (Evaluating term value (EvaluatingEffects term value))
, MonadAddressable (LocationFor value) value (Evaluating term value effects)
, MonadValue term value (Evaluating term value effects)
, Recursive term
)
=> term
-> Final (EvaluatingEffects term value) value
-> Final effects value
evaluate = runAnalysis @(Evaluating term value) . evaluateModule
-- | Evaluate terms and an entry point to a value.
evaluates :: forall value term
. ( Evaluatable (Base term)
evaluates :: forall value term effects
. ( effects ~ RequiredEffects term value (Evaluating term value effects)
, Evaluatable (Base term)
, FreeVariables term
, MonadAddressable (LocationFor value) value (Evaluating term value (EvaluatingEffects term value))
, MonadValue term value (Evaluating term value (EvaluatingEffects term value))
, MonadAddressable (LocationFor value) value (Evaluating term value effects)
, MonadValue term value (Evaluating term value effects)
, Recursive term
)
=> [(Blob, term)] -- List of (blob, term) pairs that make up the program to be evaluated
-> (Blob, term) -- Entrypoint
-> Final (EvaluatingEffects term value) value
-> Final effects value
evaluates pairs (b, t) = runAnalysis @(Evaluating term value) (withModules b pairs (evaluateModule t))
-- | Run an action with the passed ('Blob', @term@) pairs available for imports.
@ -76,11 +79,18 @@ type EvaluatingEffects term value
, State (StoreFor value) -- The heap
, Reader (ModuleTable term) -- Cache of unevaluated modules
, State (ModuleTable (EnvironmentFor value)) -- Cache of evaluated modules
, State (Map Name (Name, Maybe (Address (LocationFor value) value))) -- Set of exports
]
instance Members '[Reader (EnvironmentFor value), State (EnvironmentFor value)] effects => MonadEnvironment value (Evaluating term value effects) where
instance Members '[State (Map Name (Name, Maybe (Address (LocationFor value) value))), Reader (EnvironmentFor value), State (EnvironmentFor value)] effects => MonadEnvironment value (Evaluating term value effects) where
getGlobalEnv = raise get
putGlobalEnv = raise . put
withGlobalEnv s = raise . localState s . lower
addExport key = raise . modify . Map.insert key
getExports = raise get
withExports s = raise . localState s . lower
askLocalEnv = raise ask
localEnv f a = raise (local f (lower a))

View File

@ -8,7 +8,8 @@ import Control.Monad.Effect.Writer
import Data.Abstract.Configuration
import Data.Abstract.Value
import Data.Semigroup.Reducer as Reducer
import Prologue
import Data.Union
import Prologue hiding (trace)
-- | Trace analysis.
--

View File

@ -147,9 +147,10 @@ instance CustomHasDeclaration (Union fs) Declaration.WildcardImport where
stripQuotes = T.dropAround (`elem` ['"', '\''])
getSource = toText . flip Source.slice blobSource . getField
instance (Expression.MemberAccess :< fs) => CustomHasDeclaration (Union fs) Expression.Call where
instance (Syntax.Identifier :< fs, Expression.MemberAccess :< fs) => CustomHasDeclaration (Union fs) Expression.Call where
customToDeclaration Blob{..} _ (Expression.Call _ (Term (In fromAnn fromF), _) _ _)
| Just (Expression.MemberAccess (Term (In leftAnn leftF)) (Term (In idenAnn _))) <- prj fromF = Just $ CallReference (getSource idenAnn) (memberAccess leftAnn leftF)
| Just (Syntax.Identifier name) <- prj fromF = Just $ CallReference (T.decodeUtf8 (friendlyName name)) []
| otherwise = Just $ CallReference (getSource fromAnn) []
where
memberAccess modAnn termFOut

View File

@ -2,6 +2,8 @@
module Control.Abstract.Analysis
( MonadAnalysis(..)
, evaluateTerm
, require
, load
, liftAnalyze
, runAnalysis
, module X
@ -17,7 +19,12 @@ import Control.Monad.Effect.Fresh as X
import Control.Monad.Effect.NonDet as X
import Control.Monad.Effect.Reader as X
import Control.Monad.Effect.State as X
import Data.Abstract.Environment
import Data.Abstract.ModuleTable
import Data.Abstract.Value
import Data.Coerce
import qualified Data.Map as Map
import Prelude hiding (fail)
import Prologue
-- | A 'Monad' in which one can evaluate some specific term type to some specific value type.
@ -41,6 +48,38 @@ evaluateTerm :: MonadAnalysis term value m => term -> m value
evaluateTerm = foldSubterms analyzeTerm
-- | Require/import another term/file and return an Effect.
--
-- Looks up the term's name in the cache of evaluated modules first, returns a value if found, otherwise loads/evaluates the module.
require :: ( MonadAnalysis term value m
, Ord (LocationFor value)
)
=> ModuleName
-> m (EnvironmentFor value)
require name = getModuleTable >>= maybe (load name) pure . moduleTableLookup name
-- | Load another term/file and return an Effect.
--
-- Always loads/evaluates.
load :: ( MonadAnalysis term value m
, Ord (LocationFor value)
)
=> ModuleName
-> m (EnvironmentFor value)
load name = askModuleTable >>= maybe notFound evalAndCache . moduleTableLookup name
where notFound = fail ("cannot load module: " <> show name)
evalAndCache e = do
void $ evaluateModule e
-- TODO: If the set of exports is empty because no exports have been
-- defined, do we export all terms, or no terms? This behavior varies across
-- languages. We need better semantics rather than doing it ad-hoc.
env <- getGlobalEnv
exports <- getExports
let env' = if Map.null exports then env else bindExports exports env
modifyModuleTable (moduleTableInsert name env')
pure env'
-- | Lift a 'SubtermAlgebra' for an underlying analysis into a containing analysis. Use this when defining an analysis which can be composed onto other analyses to ensure that a call to 'analyzeTerm' occurs in the inner analysis and not the outer one.
liftAnalyze :: ( Coercible ( m term value (effects :: [* -> *]) value) (t m term value effects value)
, Coercible (t m term value effects value) ( m term value effects value)

View File

@ -12,6 +12,7 @@ module Control.Abstract.Evaluator
import Data.Abstract.Address
import Data.Abstract.Configuration
import Data.Abstract.FreeVariables
import Data.Abstract.ModuleTable
import Data.Abstract.Store
import Data.Abstract.Value
@ -40,6 +41,14 @@ class Monad m => MonadEnvironment value m | m -> value where
getGlobalEnv :: m (EnvironmentFor value)
-- | Set the global environment
putGlobalEnv :: EnvironmentFor value -> m ()
withGlobalEnv :: EnvironmentFor value -> m a -> m a
-- | Add an export to the global export state.
addExport :: Name -> (Name, Maybe (Address (LocationFor value) value)) -> m ()
-- | Get the global export state.
getExports :: m (Map Name (Name, Maybe (Address (LocationFor value) value)))
-- | Sets the exports state to the given map for the lifetime of the given action.
withExports :: Map Name (Name, Maybe (Address (LocationFor value) value)) -> m a -> m a
-- | Retrieve the local environment.
askLocalEnv :: m (EnvironmentFor value)

View File

@ -1,4 +1,4 @@
{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, UndecidableInstances #-}
{-# LANGUAGE MultiParamTypeClasses, Rank2Types, TypeFamilies, TypeOperators, UndecidableInstances #-}
module Control.Abstract.Value where
import Control.Abstract.Addressable
@ -7,10 +7,20 @@ import Data.Abstract.Environment
import Data.Abstract.FreeVariables
import Data.Abstract.Type as Type
import Data.Abstract.Value as Value
import Data.Scientific (Scientific)
import Data.Scientific (Scientific, fromFloatDigits, toRealFloat)
import Prelude hiding (fail)
import Prologue
-- | This datum is passed into liftComparison to handle the fact that Ruby and PHP
-- have built-in generalized-comparison ("spaceship") operators. If you want to
-- encapsulate a traditional, boolean-returning operator, wrap it in 'Concrete';
-- if you want the generalized comparator, pass in 'Generalized'. In MonadValue
-- instances, you can then then handle the different cases to return different
-- types, if that's what you need.
data Comparator
= Concrete (forall a . Ord a => a -> a -> Bool)
| Generalized
-- | A 'Monad' abstracting the evaluation of (and under) binding constructs (functions, methods, etc).
--
-- This allows us to abstract the choice of whether to evaluate under binders for different value types.
@ -22,6 +32,21 @@ class (MonadAnalysis term value m, Show value) => MonadValue term value m where
-- | Construct an abstract integral value.
integer :: Prelude.Integer -> m value
-- | Lift a unary operator over a 'Num' to a function on 'value's.
liftNumeric :: (forall a . Num a => a -> a)
-> (value -> m value)
-- | Lift a pair of binary operators to a function on 'value's.
-- You usually pass the same operator as both arguments, except in the cases where
-- Haskell provides different functions for integral and fractional operations, such
-- as division, exponentiation, and modulus.
liftNumeric2 :: (forall a . (Real a, Floating a) => a -> a -> a)
-> (forall b . Integral b => b -> b -> b)
-> (value -> value -> m value)
-- | Lift a Comparator (usually wrapping a function like == or <=) to a function on values.
liftComparison :: Comparator -> (value -> value -> m value)
-- | Construct an abstract boolean value.
boolean :: Bool -> m value
@ -34,19 +59,46 @@ class (MonadAnalysis term value m, Show value) => MonadValue term value m where
-- | Construct an N-ary tuple of multiple (possibly-disjoint) values
multiple :: [value] -> m value
-- | Construct an abstract interface value.
interface :: value -> m value
-- | Eliminate boolean values. TODO: s/boolean/truthy
ifthenelse :: value -> m value -> m value -> m value
ifthenelse :: value -> m a -> m a -> m a
-- | Evaluate an abstraction (a binder like a lambda or method definition).
abstract :: [Name] -> Subterm term (m value) -> m value
-- | Evaluate an application (like a function call).
apply :: value -> [Subterm term (m value)] -> m value
-- | Extract the environment from an interface value.
environment :: value -> m (EnvironmentFor value)
-- | Attempt to extract a 'Prelude.Bool' from a given value.
toBool :: MonadValue term value m => value -> m Bool
toBool v = ifthenelse v (pure True) (pure False)
forLoop :: MonadValue term value m
=> m value -- | Initial statement
-> m value -- | Condition
-> m value -- | Increment/stepper
-> m value -- | Body
-> m value
forLoop initial cond step body = do
void initial
env <- getGlobalEnv
localEnv (mappend env) (fix $ \ loop -> do
cond' <- cond
ifthenelse cond' (do
void body
void step
loop) unit)
-- | The fundamental looping primitive, built on top of ifthenelse.
while :: MonadValue term value m => m value -> m value -> m value
while cond body = do
this <- cond
ifthenelse this (body *> while cond body) unit
-- | Do-while loop, built on top of while.
doWhile :: MonadValue term value m => m value -> m value -> m value
doWhile body cond = do
void body
this <- cond
ifthenelse this (doWhile body cond) unit
-- | Construct a 'Value' wrapping the value arguments (if any).
instance ( MonadAddressable location (Value location term) m
@ -64,12 +116,53 @@ instance ( MonadAddressable location (Value location term) m
multiple vals =
pure . injValue $ Value.Tuple vals
interface v = injValue . Value.Interface v <$> getGlobalEnv
ifthenelse cond if' else'
| Just (Boolean b) <- prjValue cond = if b then if' else else'
| otherwise = fail ("not defined for non-boolean conditions: " <> show cond)
liftNumeric f arg
| Just (Integer i) <- prjValue arg = pure . injValue . Integer $ f i
| Just (Value.Float i) <- prjValue arg = pure . injValue . Value.Float $ f i
| otherwise = fail ("Invalid operand to liftNumeric: " <> show arg)
liftNumeric2 f g left right
| Just (Integer i, Integer j) <- prjPair pair = pure . injValue . Integer $ g i j
| Just (Integer i, Value.Float j) <- prjPair pair = pure . injValue . float $ f (fromIntegral i) (munge j)
| Just (Value.Float i, Value.Float j) <- prjPair pair = pure . injValue . float $ f (munge i) (munge j)
| Just (Value.Float i, Integer j) <- prjPair pair = pure . injValue . float $ f (munge i) (fromIntegral j)
| otherwise = fail ("Invalid operands to liftNumeric2: " <> show pair)
where
-- Yucky hack to work around the lack of a Floating instance for Scientific.
-- This may possibly lose precision, but there's little we can do about that.
munge :: Scientific -> Double
munge = toRealFloat
float :: Double -> Value.Float a
float = Value.Float . fromFloatDigits
pair = (left, right)
liftComparison comparator left right
| Just (Integer i, Integer j) <- prjPair pair = go i j
| Just (Integer i, Value.Float j) <- prjPair pair = go (fromIntegral i) j
| Just (Value.Float i, Integer j) <- prjPair pair = go i (fromIntegral j)
| Just (Value.Float i, Value.Float j) <- prjPair pair = go i j
| Just (Value.String i, Value.String j) <- prjPair pair = go i j
| Just (Boolean i, Boolean j) <- prjPair pair = go i j
| Just (Value.Unit, Value.Unit) <- prjPair pair = boolean True
| otherwise = fail ("Type error: invalid arguments to liftComparison: " <> show pair)
where
-- Explicit type signature is necessary here because we're passing all sorts of things
-- to these comparison functions.
go :: (Ord a, MonadValue term value m) => a -> a -> m value
go l r = case comparator of
Concrete f -> boolean (f l r)
Generalized -> integer (orderingToInt (compare l r))
-- Map from [LT, EQ, GT] to [-1, 0, 1]
orderingToInt :: Ordering -> Prelude.Integer
orderingToInt = toInteger . pred . fromEnum
pair = (left, right)
abstract names (Subterm body _) = injValue . Closure names body <$> askLocalEnv
apply op params = do
@ -81,10 +174,6 @@ instance ( MonadAddressable location (Value location term) m
envInsert name a <$> rest) (pure env) (zip names params)
localEnv (mappend bindings) (evaluateTerm body)
environment v
| Just (Interface _ env) <- prjValue v = pure env
| otherwise = pure mempty
-- | Discard the value arguments (if any), constructing a 'Type.Type' instead.
instance (Alternative m, MonadAnalysis term Type m, MonadFresh m) => MonadValue term Type m where
abstract names (Subterm _ body) = do
@ -103,16 +192,22 @@ instance (Alternative m, MonadAnalysis term Type m, MonadFresh m) => MonadValue
string _ = pure Type.String
float _ = pure Type.Float
multiple = pure . Type.Product
-- TODO
interface = undefined
ifthenelse cond if' else' = unify cond Bool *> (if' <|> else')
liftNumeric _ Type.Float = pure Type.Float
liftNumeric _ Int = pure Int
liftNumeric _ _ = fail "Invalid type in unary numeric operation"
liftNumeric2 _ _ left right = case (left, right) of
(Type.Float, Int) -> pure Type.Float
(Int, Type.Float) -> pure Type.Float
_ -> unify left right
liftComparison _ left right = pure left <|> pure right
apply op params = do
tvar <- fresh
paramTypes <- traverse subtermValue params
_ :-> ret <- op `unify` (Product paramTypes :-> Var tvar)
pure ret
-- TODO
environment = undefined

View File

@ -1,4 +1,4 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE GeneralizedNewtypeDeriving, MultiParamTypeClasses, StandaloneDeriving #-}
module Data.Abstract.Environment where
import Prologue
@ -6,12 +6,15 @@ import Data.Abstract.Address
import Data.Abstract.FreeVariables
import Data.Abstract.Live
import qualified Data.Map as Map
import Data.Semigroup.Reducer
import qualified Data.Set as Set
-- | A map of names to addresses that represents the evaluation environment.
newtype Environment l a = Environment { unEnvironment :: Map.Map Name (Address l a) }
deriving (Eq, Foldable, Functor, Generic1, Monoid, Ord, Semigroup, Show, Traversable)
deriving instance Reducer (Name, Address l a) (Environment l a)
-- | Lookup a 'Name' in the environment.
envLookup :: Name -> Environment l a -> Maybe (Address l a)
envLookup k = Map.lookup k . unEnvironment
@ -20,12 +23,15 @@ envLookup k = Map.lookup k . unEnvironment
envInsert :: Name -> Address l a -> Environment l a -> Environment l a
envInsert name value (Environment m) = Environment (Map.insert name value m)
envUnion :: Environment l a -> Environment l a -> Environment l a
envUnion (Environment e1) (Environment e2) = Environment $ Map.union e1 e2
bindEnv :: (Ord l, Foldable t) => t Name -> Environment l a -> Environment l a
bindEnv names env = Environment (Map.fromList pairs)
where pairs = foldr (\name b -> maybe b (\v -> (name, v) : b) (envLookup name env)) mempty names
bindEnv names env = foldMap envForName names
where envForName name = maybe mempty (curry unit name) (envLookup name env)
bindExports :: (Ord l) => Map Name (Name, Maybe (Address l a)) -> Environment l a -> Environment l a
bindExports aliases env = Environment pairs
where
pairs = Map.foldrWithKey (\name (alias, address) accum ->
maybe accum (\v -> Map.insert alias v accum) (address <|> envLookup name env)) mempty aliases
-- | Retrieve the 'Live' set of addresses to which the given free variable names are bound.
--

View File

@ -6,20 +6,16 @@ module Data.Abstract.Evaluatable
, module FreeVariables
, module Value
, MonadEvaluator(..)
, require
, load
) where
import Control.Abstract.Addressable as Addressable
import Control.Abstract.Analysis as Analysis
import Control.Abstract.Value as Value
import Data.Abstract.Environment
import Data.Abstract.FreeVariables as FreeVariables
import Data.Abstract.ModuleTable
import Data.Abstract.Value
import Data.Functor.Classes
import Data.Proxy
import Data.Semigroup
import Data.Semigroup.Foldable
import Data.Term
import Prelude hiding (fail)
import Prologue
@ -42,7 +38,7 @@ instance Apply Evaluatable fs => Evaluatable (Union fs) where
-- | Evaluating a 'TermF' ignores its annotation, evaluating the underlying syntax.
instance Evaluatable s => Evaluatable (TermF s a) where
eval In{..} = eval termFOut
eval = eval . termFOut
-- Instances
@ -53,42 +49,17 @@ instance Evaluatable s => Evaluatable (TermF s a) where
-- 2. Each statement can affect the environment of later statements (e.g. by 'modify'-ing the environment); and
-- 3. Only the last statements return value is returned.
instance Evaluatable [] where
eval [] = unit -- Return unit value if this is an empty list of terms
eval [x] = subtermValue x -- Return the value for the last term
eval (x:xs) = do
_ <- subtermValue x -- Evaluate the head term
env <- getGlobalEnv -- Get the global environment after evaluation
-- since it might have been modified by the
-- evaluation above ^.
-- 'nonEmpty' and 'foldMap1' enable us to return the last statements result instead of 'unit' for non-empty lists.
eval = maybe unit (runImperative . foldMap1 (Imperative . subtermValue)) . nonEmpty
-- Finally, evaluate the rest of the terms, but do so by calculating a new
-- environment each time where the free variables in those terms are bound
-- to the global environment.
localEnv (const (bindEnv (liftFreeVariables (freeVariables . subterm) xs) env)) (eval xs)
-- | A 'Semigroup' providing an imperative context which extends the local environment with new bindings.
newtype Imperative m a = Imperative { runImperative :: m a }
instance MonadEnvironment value m => Semigroup (Imperative m a) where
Imperative a <> Imperative b = Imperative $ a *> do
env <- getGlobalEnv
localEnv (<> env) b
-- | Require/import another term/file and return an Effect.
--
-- Looks up the term's name in the cache of evaluated modules first, returns a value if found, otherwise loads/evaluates the module.
require :: ( MonadAnalysis term value m
, MonadValue term value m
)
=> ModuleName
-> m (EnvironmentFor value)
require name = getModuleTable >>= maybe (load name) pure . moduleTableLookup name
-- | Load another term/file and return an Effect.
--
-- Always loads/evaluates.
load :: ( MonadAnalysis term value m
, MonadValue term value m
)
=> ModuleName
-> m (EnvironmentFor value)
load name = askModuleTable >>= maybe notFound evalAndCache . moduleTableLookup name
where notFound = fail ("cannot load module: " <> show name)
evalAndCache e = do
v <- evaluateModule e
env <- environment v
modifyModuleTable (moduleTableInsert name env)
pure env
instance MonadValue term value m => Monoid (Imperative m value) where
mempty = Imperative unit
mappend = (<>)

View File

@ -39,7 +39,9 @@ freeVariables1 :: (FreeVariables1 t, FreeVariables a) => t a -> Set Name
freeVariables1 = liftFreeVariables freeVariables
freeVariable :: FreeVariables term => term -> Name
freeVariable term = let [n] = toList (freeVariables term) in n
freeVariable term = case toList (freeVariables term) of
[n] -> n
xs -> Prelude.fail ("expected single free variable, but got: " <> show xs)
-- TODO: Need a dedicated concept of qualified names outside of freevariables (a
-- Set) b/c you can have something like `a.a.b.a`

View File

@ -24,11 +24,11 @@ data Type
-- | Unify two 'Type's.
unify :: MonadFail m => Type -> Type -> m Type
unify Int Int = pure Int
unify Bool Bool = pure Bool
unify (a1 :-> b1) (a2 :-> b2) = (:->) <$> unify a1 a2 <*> unify b1 b2
-- FIXME: this should be constructing a substitution.
unify (Var _) b = pure b
unify a (Var _) = pure a
unify (Product as) (Product bs) = Product <$> sequenceA (alignWith (these pure pure unify) as bs)
unify t1 t2 = fail ("cannot unify " ++ show t1 ++ " with " ++ show t2)
unify t1 t2
| t1 == t2 = pure t2
| otherwise = fail ("cannot unify " ++ show t1 ++ " with " ++ show t2)

View File

@ -10,12 +10,11 @@ import qualified Data.Abstract.Type as Type
import qualified Data.Set as Set
import Data.Scientific (Scientific)
import Prologue
import Prelude hiding (Float, Integer, String, fail)
import Prelude hiding (Float, Integer, String)
import qualified Prelude
type ValueConstructors location term
= '[Closure location term
, Interface location
, Unit
, Boolean
, Float
@ -37,6 +36,13 @@ injValue = Value . inj
prjValue :: (f :< ValueConstructors location term) => Value location term -> Maybe (f (Value location term))
prjValue = prj . deValue
-- | Convenience function for projecting two values.
prjPair :: ( f :< ValueConstructors loc term1 , g :< ValueConstructors loc term2)
=> (Value loc term1, Value loc term2)
-> Maybe (f (Value loc term1), g (Value loc term2))
prjPair = bitraverse prjValue prjValue
-- TODO: Parameterize Value by the set of constructors s.t. each language can have a distinct value union.
-- | A function value consisting of a list of parameters, the body of the function, and an environment of bindings captured by the body.
@ -47,14 +53,6 @@ instance (Eq location, Eq term) => Eq1 (Closure location term) where liftEq = ge
instance (Ord location, Ord term) => Ord1 (Closure location term) where liftCompare = genericLiftCompare
instance (Show location, Show term) => Show1 (Closure location term) where liftShowsPrec = genericLiftShowsPrec
-- | A program value consisting of the value of the program and it's enviornment of bindings.
data Interface location value = Interface value (Environment location value)
deriving (Eq, Generic1, Ord, Show)
instance (Eq location) => Eq1 (Interface location) where liftEq = genericLiftEq
instance (Ord location) => Ord1 (Interface location) where liftCompare = genericLiftCompare
instance (Show location) => Show1 (Interface location) where liftShowsPrec = genericLiftShowsPrec
-- | The unit value. Typically used to represent the result of imperative statements.
data Unit value = Unit
deriving (Eq, Generic1, Ord, Show)

View File

@ -124,14 +124,8 @@ instance Ord1 Program where liftCompare = genericLiftCompare
instance Show1 Program where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Program where
eval (Program xs) = eval' xs
where
eval' [] = unit >>= interface
eval' [x] = subtermValue x >>= interface
eval' (x:xs) = do
_ <- subtermValue x
env <- getGlobalEnv
localEnv (envUnion env) (eval' xs)
eval (Program xs) = do
withExports mempty (eval xs)
-- | An accessibility modifier, e.g. private, public, protected, etc.
newtype AccessibilityModifier a = AccessibilityModifier ByteString

View File

@ -161,14 +161,7 @@ instance Show1 Module where liftShowsPrec = genericLiftShowsPrec
-- We need to ensure that all input files have aggregated their content into
-- a coherent module before we begin evaluating a module.
instance Evaluatable Module where
eval (Module _ xs) = eval' xs
where
eval' [] = unit >>= interface
eval' [x] = subtermValue x >>= interface
eval' (x:xs) = do
_ <- subtermValue x
env <- getGlobalEnv
localEnv (envUnion env) (eval' xs)
eval (Module _ xs) = eval xs
-- | A decorator in Python
data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a }
@ -219,6 +212,39 @@ instance Show1 Comprehension where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for Comprehension
instance Evaluatable Comprehension
-- | Qualified Export declarations
newtype QualifiedExport a = QualifiedExport { qualifiedExportSymbols :: [(Name, Name)] }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 QualifiedExport where liftEq = genericLiftEq
instance Ord1 QualifiedExport where liftCompare = genericLiftCompare
instance Show1 QualifiedExport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable QualifiedExport where
eval (QualifiedExport exportSymbols) = do
-- Insert the aliases with no addresses.
for_ exportSymbols $ \(name, alias) ->
addExport name (alias, Nothing)
unit
-- | Qualified Export declarations that export from another module.
data QualifiedExportFrom a = QualifiedExportFrom { qualifiedExportFrom :: !a, qualifiedExportFromSymbols :: ![(Name, Name)]}
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 QualifiedExportFrom where liftEq = genericLiftEq
instance Ord1 QualifiedExportFrom where liftCompare = genericLiftCompare
instance Show1 QualifiedExportFrom where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable QualifiedExportFrom where
eval (QualifiedExportFrom from exportSymbols) = do
let moduleName = freeVariable (subterm from)
importedEnv <- withGlobalEnv mempty (require moduleName)
-- Look up addresses in importedEnv and insert the aliases with addresses into the exports.
for_ exportSymbols $ \(name, alias) -> do
let address = Map.lookup name (unEnvironment importedEnv)
addExport name (alias, address)
unit
-- | Qualified Import declarations (symbols are qualified in calling environment).
data QualifiedImport a = QualifiedImport { qualifiedImportFrom :: !a, qualifiedImportAlias :: !a, qualifiedImportSymbols :: ![(Name, Name)]}
@ -230,23 +256,29 @@ instance Show1 QualifiedImport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable QualifiedImport where
eval (QualifiedImport from alias xs) = do
env <- getGlobalEnv
putGlobalEnv mempty
importedEnv <- require (freeVariable (subterm from))
env' <- Map.foldrWithKey copy (pure env) (unEnvironment importedEnv)
modifyGlobalEnv (const env')
importedEnv <- withGlobalEnv mempty (require (freeVariable (subterm from)))
modifyGlobalEnv (flip (Map.foldrWithKey copy) (unEnvironment importedEnv))
unit
where
prefix = freeVariable (subterm alias)
symbols = Map.fromList xs
copy = if Map.null symbols then qualifyInsert else directInsert
qualifyInsert k v rest = envInsert (prefix <> k) v <$> rest
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v <$> rest) (Map.lookup k symbols)
qualifyInsert k v rest = envInsert (prefix <> k) v rest
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v rest) (Map.lookup k symbols)
newtype DefaultExport a = DefaultExport { defaultExport :: a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 DefaultExport where liftEq = genericLiftEq
instance Ord1 DefaultExport where liftCompare = genericLiftCompare
instance Show1 DefaultExport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable DefaultExport where
-- | Import declarations (symbols are added directly to the calling env).
--
-- If symbols is empty, just evaluate the module for it's side effects.
-- If symbols is empty, just import the module for its side effects.
data Import a = Import { importFrom :: !a, importSymbols :: ![(Name, Name)] }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
@ -256,15 +288,12 @@ instance Show1 Import where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Import where
eval (Import from xs) = do
env <- getGlobalEnv
putGlobalEnv mempty
importedEnv <- require (freeVariable (subterm from))
env' <- Map.foldrWithKey directInsert (pure env) (unEnvironment importedEnv)
modifyGlobalEnv (const env')
importedEnv <- withGlobalEnv mempty (require (freeVariable (subterm from)))
modifyGlobalEnv (flip (Map.foldrWithKey directInsert) (unEnvironment importedEnv))
unit
where
symbols = Map.fromList xs
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v <$> rest) (Map.lookup k symbols)
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v rest) (Map.lookup k symbols)
-- | A wildcard import (all symbols are added directly to the calling env)
@ -278,7 +307,10 @@ instance Ord1 WildcardImport where liftCompare = genericLiftCompare
instance Show1 WildcardImport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable WildcardImport where
eval (WildcardImport from _) = putGlobalEnv mempty *> require (freeVariable (subterm from)) *> unit
eval (WildcardImport from _) = do -- require (freeVariable (subterm from)) *> putGlobalEnv mempty *> unit
importedEnv <- withGlobalEnv mempty (require (freeVariable (subterm from)))
modifyGlobalEnv (flip (Map.foldrWithKey envInsert) (unEnvironment importedEnv))
unit
-- | A declared type (e.g. `a []int` in Go).
data Type a = Type { typeName :: !a, typeKind :: !a }

View File

@ -2,7 +2,9 @@
module Data.Syntax.Expression where
import Data.Abstract.Evaluatable
import Data.Fixed
import Diffing.Algorithm
import Prelude hiding (fail)
import Prologue hiding (apply)
-- | Typical prefix function application, like `f(x)` in many languages, or `f x` in Haskell.
@ -31,9 +33,15 @@ instance Eq1 Comparison where liftEq = genericLiftEq
instance Ord1 Comparison where liftCompare = genericLiftCompare
instance Show1 Comparison where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for Comparison
instance Evaluatable Comparison
instance Evaluatable Comparison where
eval = traverse subtermValue >=> go where
go x = case x of
(LessThan a b) -> liftComparison (Concrete (<)) a b
(LessThanEqual a b) -> liftComparison (Concrete (<=)) a b
(GreaterThan a b) -> liftComparison (Concrete (>)) a b
(GreaterThanEqual a b) -> liftComparison (Concrete (>=)) a b
(Equal a b) -> liftComparison (Concrete (==)) a b
(Comparison a b) -> liftComparison Generalized a b
-- | Binary arithmetic operators.
data Arithmetic a
@ -51,8 +59,15 @@ instance Ord1 Arithmetic where liftCompare = genericLiftCompare
instance Show1 Arithmetic where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for Arithmetic
instance Evaluatable Arithmetic
instance Evaluatable Arithmetic where
eval = traverse subtermValue >=> go where
go (Plus a b) = liftNumeric2 (+) (+) a b
go (Minus a b) = liftNumeric2 (-) (-) a b
go (Times a b) = liftNumeric2 (*) (*) a b
go (DividedBy a b) = liftNumeric2 (/) div a b
go (Modulo a b) = liftNumeric2 mod' mod a b
go (Power a b) = liftNumeric2 (**) (^) a b
go (Negate a) = liftNumeric negate a
-- | Boolean operators.
data Boolean a
@ -66,9 +81,17 @@ instance Eq1 Boolean where liftEq = genericLiftEq
instance Ord1 Boolean where liftCompare = genericLiftCompare
instance Show1 Boolean where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for Boolean
instance Evaluatable Boolean
instance Evaluatable Boolean where
-- N.B. we have to use Monad rather than Applicative/Traversable on 'And' and 'Or' so that we don't evaluate both operands
eval = go . fmap subtermValue where
go (And a b) = do
cond <- a
ifthenelse cond b (pure cond)
go (Or a b) = do
cond <- a
ifthenelse cond (pure cond) b
go (Not a) = a >>= toBool >>= boolean . not
go (XOr a b) = liftA2 (/=) (a >>= toBool) (b >>= toBool) >>= boolean
-- | Javascript delete operator
newtype Delete a = Delete a

View File

@ -1,9 +1,10 @@
{-# LANGUAGE DeriveAnyClass, MultiParamTypeClasses, ScopedTypeVariables, UndecidableInstances #-}
{-# LANGUAGE DeriveAnyClass, MultiParamTypeClasses, ScopedTypeVariables, UndecidableInstances, ViewPatterns #-}
module Data.Syntax.Statement where
import Data.Abstract.Environment
import Data.Abstract.Evaluatable
import Diffing.Algorithm
import Prelude hiding (fail)
import Prologue
-- | Conditional. This must have an else block, which can be filled with some default value when omitted in the source, e.g. 'pure ()' for C-style if-without-else or 'pure Nothing' for Ruby-style, in both cases assuming some appropriate Applicative context into which the If will be lifted.
@ -185,7 +186,6 @@ instance Eq1 NoOp where liftEq = genericLiftEq
instance Ord1 NoOp where liftCompare = genericLiftCompare
instance Show1 NoOp where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for NoOp
instance Evaluatable NoOp where
eval _ = unit
@ -198,8 +198,8 @@ instance Eq1 For where liftEq = genericLiftEq
instance Ord1 For where liftCompare = genericLiftCompare
instance Show1 For where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for For
instance Evaluatable For
instance Evaluatable For where
eval (fmap subtermValue -> For before cond step body) = forLoop before cond step body
data ForEach a = ForEach { forEachBinding :: !a, forEachSubject :: !a, forEachBody :: !a }
@ -220,9 +220,8 @@ instance Eq1 While where liftEq = genericLiftEq
instance Ord1 While where liftCompare = genericLiftCompare
instance Show1 While where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for While
instance Evaluatable While
instance Evaluatable While where
eval While{..} = while (subtermValue whileCondition) (subtermValue whileBody)
data DoWhile a = DoWhile { doWhileCondition :: !a, doWhileBody :: !a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
@ -231,9 +230,8 @@ instance Eq1 DoWhile where liftEq = genericLiftEq
instance Ord1 DoWhile where liftCompare = genericLiftCompare
instance Show1 DoWhile where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for DoWhile
instance Evaluatable DoWhile
instance Evaluatable DoWhile where
eval DoWhile{..} = doWhile (subtermValue doWhileBody) (subtermValue doWhileCondition)
-- Exception handling

View File

@ -390,7 +390,8 @@ importDeclaration = makeTerm'' <$> symbol ImportDeclaration <*> children (manyTe
<|> makeTerm <$> symbol ImportSpec <*> children namedImport
<|> makeTerm <$> symbol ImportSpec <*> children plainImport
dotImport = symbol Dot *> source *> (Declaration.WildcardImport <$> expression <*> emptyTerm)
dotImport = symbol Dot *> source >>= \s ->
Declaration.WildcardImport <$> expression <*> (makeTerm <$> location <*> pure (Syntax.Identifier (name s)))
sideEffectImport = symbol BlankIdentifier *> source *> (Declaration.Import <$> expression <*> pure [])
namedImport = symbol PackageIdentifier >>= \loc -> do
s <- source

View File

@ -7,12 +7,13 @@ module Language.TypeScript.Assignment
) where
import Assigning.Assignment hiding (Assignment, Error)
import qualified Assigning.Assignment as Assignment
import Data.Abstract.FreeVariables
import qualified Data.ByteString as B (filter)
import qualified Data.ByteString.Char8 as BC
import Data.Char (ord)
import Data.Record
import Data.Syntax (emptyTerm, handleError, parseError, infixContext, makeTerm, makeTerm', makeTerm'', makeTerm1, contextualize, postContextualize)
import Language.TypeScript.Grammar as Grammar
import Prologue
import qualified Assigning.Assignment as Assignment
import qualified Data.Syntax as Syntax
import qualified Data.Syntax.Comment as Comment
import qualified Data.Syntax.Declaration as Declaration
@ -21,7 +22,9 @@ import qualified Data.Syntax.Literal as Literal
import qualified Data.Syntax.Statement as Statement
import qualified Data.Syntax.Type as Type
import qualified Data.Term as Term
import Language.TypeScript.Grammar as Grammar
import qualified Language.TypeScript.Syntax as TypeScript.Syntax
import Prologue
-- | The type of TypeScript syntax.
type Syntax = '[
@ -36,6 +39,9 @@ type Syntax = '[
, Declaration.TypeAlias
, Declaration.Import
, Declaration.QualifiedImport
, Declaration.DefaultExport
, Declaration.QualifiedExport
, Declaration.QualifiedExportFrom
, Declaration.Module
, Expression.Arithmetic
, Expression.Bitwise
@ -156,8 +162,6 @@ type Syntax = '[
, TypeScript.Syntax.ImportRequireClause
, TypeScript.Syntax.ImportClause
, TypeScript.Syntax.LabeledStatement
, TypeScript.Syntax.NamedImports
, TypeScript.Syntax.NamespaceImport
, TypeScript.Syntax.Annotation
, TypeScript.Syntax.With
, TypeScript.Syntax.ForOf
@ -262,7 +266,12 @@ ternaryExpression :: Assignment
ternaryExpression = makeTerm <$> symbol Grammar.TernaryExpression <*> children (Statement.If <$> term expression <*> term expression <*> term expression)
memberExpression :: Assignment
memberExpression = makeTerm <$> (symbol Grammar.MemberExpression <|> symbol Grammar.MemberExpression') <*> children (Expression.MemberAccess <$> term expression <*> term propertyIdentifier)
memberExpression = (symbol Grammar.MemberExpression <|> symbol Grammar.MemberExpression') *> children (qualifiedIdentifier <|> memberAccess)
where
memberAccess = makeTerm <$> location <*> (Expression.MemberAccess <$> term expression <*> term propertyIdentifier)
qualifiedIdentifier = makeTerm <$> location <*> ((\a b -> Syntax.Identifier (qualifiedName [a, b])) <$> identifier' <*> propertyIdentifier')
identifier' = (symbol Identifier <|> symbol Identifier') *> source
propertyIdentifier' = symbol PropertyIdentifier *> source
newExpression :: Assignment
newExpression = makeTerm <$> symbol Grammar.NewExpression <*> children (Expression.New . pure <$> term expression)
@ -632,18 +641,21 @@ statementIdentifier :: Assignment
statementIdentifier = makeTerm <$> symbol StatementIdentifier <*> (Syntax.Identifier <$> (name <$> source))
importStatement :: Assignment
importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children ((,) <$> importClause <*> term string)
importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children ((,) <$> importClause <*> term path)
<|> makeImport <$> symbol Grammar.ImportStatement <*> children requireImport
<|> makeImport <$> symbol Grammar.ImportStatement <*> children bareRequireImport
where
-- Straightforward imports
makeImport loc (Just alias, symbols, from) = makeTerm loc (Declaration.QualifiedImport from alias symbols)
makeImport loc (Nothing, symbols, from) = makeTerm loc (Declaration.Import from symbols)
-- Import a file giving it an alias (e.g. import foo = require "./foo")
requireImport = symbol Grammar.ImportRequireClause *> children ((,,) <$> (Just <$> (term identifier)) <*> pure [] <*> term string)
requireImport = symbol Grammar.ImportRequireClause *> children ((,,) <$> (Just <$> (term identifier)) <*> pure [] <*> term path)
-- Import a file just for it's side effects (e.g. import "./foo")
bareRequireImport = (,,) <$> (pure Nothing) <*> pure [] <*> term string
bareRequireImport = (,,) <$> (pure Nothing) <*> pure [] <*> term path
path = makeTerm <$> symbol Grammar.String <*> (Syntax.Identifier <$> (qualifiedName' <$> source))
qualifiedName' = qualifiedName . BC.split '/' . (BC.dropWhile (== '/')) . (BC.dropWhile (== '.')) . stripQuotes
stripQuotes = B.filter (/= (fromIntegral (ord '\"')))
-- Imports with import clauses
makeImportTerm1 loc from (Prelude.True, Just alias, symbols) = makeTerm loc (Declaration.QualifiedImport from alias symbols)
@ -666,6 +678,10 @@ importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children
makeNameAliasPair from (Just alias) = (from, alias)
makeNameAliasPair from Nothing = (from, from)
stripQuotes :: ByteString -> ByteString
stripQuotes = B.filter (/= (fromIntegral (ord '\"')))
debuggerStatement :: Assignment
debuggerStatement = makeTerm <$> symbol Grammar.DebuggerStatement <*> (TypeScript.Syntax.Debugger <$ source)
@ -709,16 +725,21 @@ ambientDeclaration :: Assignment
ambientDeclaration = makeTerm <$> symbol Grammar.AmbientDeclaration <*> children (TypeScript.Syntax.AmbientDeclaration <$> term (choice [declaration, statementBlock]))
exportStatement :: Assignment
exportStatement = makeTerm <$> symbol Grammar.ExportStatement <*> children (TypeScript.Syntax.Export <$> (((\a b -> [a, b]) <$> term exportClause <*> term fromClause) <|> ((++) <$> manyTerm decorator <*> (pure <$> term (fromClause <|> exportClause <|> declaration <|> expression <|> identifier <|> importAlias')))))
exportStatement = makeTerm <$> symbol Grammar.ExportStatement <*> (children (flip Declaration.QualifiedExportFrom <$> exportClause <*> term fromClause))
<|> makeTerm <$> symbol Grammar.ExportStatement <*> children (Declaration.QualifiedExport <$> exportClause)
<|> makeTerm <$> symbol Grammar.ExportStatement <*> children (Declaration.DefaultExport <$> contextualize decorator (term (declaration <|> expression <|> identifier <|> importAlias')))
where
exportClause = symbol Grammar.ExportClause *> children (many exportSymbol)
exportSymbol = symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> (Just <$> rawIdentifier))
<|> symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> (pure Nothing))
makeNameAliasPair from (Just alias) = (from, alias)
makeNameAliasPair from Nothing = (from, from)
rawIdentifier = (symbol Identifier <|> symbol Identifier') *> (name <$> source)
-- <|> (makeExport2 <$> manyTerm decorator <*> emptyTerm <*> (pure <$> term (fromClause <|> exportClause <|> declaration <|> expression <|> identifier <|> importAlias')))))
-- makeExport2 decorators fromClause exportClause = Declaration.QualifiedExport fromClause exportClause
fromClause :: Assignment
fromClause = string
exportClause :: Assignment
exportClause = makeTerm <$> symbol Grammar.ExportClause <*> children (TypeScript.Syntax.ExportClause <$> manyTerm importExportSpecifier)
importExportSpecifier :: Assignment
importExportSpecifier = makeTerm <$> (symbol Grammar.ExportSpecifier <|> symbol Grammar.ImportSpecifier) <*> children (TypeScript.Syntax.ImportExportSpecifier <$> term identifier <*> (term identifier <|> emptyTerm))
fromClause = makeTerm <$> symbol Grammar.String <*> (Syntax.Identifier . name . stripQuotes <$> source)
propertySignature :: Assignment
propertySignature = makePropertySignature <$> symbol Grammar.PropertySignature <*> children ((,,,) <$> (term accessibilityModifier' <|> emptyTerm) <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> (term typeAnnotation' <|> emptyTerm))

View File

@ -71,14 +71,6 @@ instance Ord1 ImportClause where liftCompare = genericLiftCompare
instance Show1 ImportClause where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ImportClause
newtype NamespaceImport a = NamespaceImport { _namespaceImportSubject :: a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 NamespaceImport where liftEq = genericLiftEq
instance Ord1 NamespaceImport where liftCompare = genericLiftCompare
instance Show1 NamespaceImport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable NamespaceImport
newtype Tuple a = Tuple { _tupleElements :: [a] }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
@ -241,14 +233,6 @@ instance Ord1 ImportExportSpecifier where liftCompare = genericLiftCompare
instance Show1 ImportExportSpecifier where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ImportExportSpecifier
newtype NamedImports a = NamedImports { _namedImportElements :: [a] }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 NamedImports where liftEq = genericLiftEq
instance Ord1 NamedImports where liftCompare = genericLiftCompare
instance Show1 NamedImports where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable NamedImports
data With a = With { _withExpression :: !a, _withBody :: !a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)

View File

@ -23,6 +23,8 @@ import Data.List.NonEmpty as X (
, some1
)
import Debug.Trace as X
import Control.Exception as X hiding (
evaluate
, throw

View File

@ -1,5 +1,6 @@
-- MonoLocalBinds is to silence a warning about a simplifiable constraint.
{-# LANGUAGE DataKinds, MonoLocalBinds, TypeApplications, TypeOperators #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}
module Semantic.Util where
import Analysis.Abstract.Caching

View File

@ -9,13 +9,13 @@
->(Identifier) })
{+(WildcardImport
{+(TextElement)+}
{+(Empty)+})+}
{+(Identifier)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+}
{-(WildcardImport
{-(TextElement)-}
{-(Empty)-})-}
{-(Identifier)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-})

View File

@ -9,13 +9,13 @@
->(Identifier) })
{+(WildcardImport
{+(TextElement)+}
{+(Empty)+})+}
{+(Identifier)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+}
{-(WildcardImport
{-(TextElement)-}
{-(Empty)-})-}
{-(Identifier)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-})

View File

@ -7,7 +7,7 @@
(Identifier))
(WildcardImport
(TextElement)
(Empty))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)))

View File

@ -7,7 +7,7 @@
(Identifier))
(WildcardImport
(TextElement)
(Empty))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)))

View File

@ -9,7 +9,7 @@
(WildcardImport
{ (TextElement)
->(TextElement) }
(Empty))
(Identifier))
(QualifiedImport
{ (TextElement)
->(TextElement) }

View File

@ -9,7 +9,7 @@
(WildcardImport
{ (TextElement)
->(TextElement) }
(Empty))
(Identifier))
(QualifiedImport
{ (TextElement)
->(TextElement) }

View File

@ -6,7 +6,7 @@
(Identifier))
(WildcardImport
(TextElement)
(Empty))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier))

View File

@ -6,7 +6,7 @@
(Identifier))
(WildcardImport
(TextElement)
(Empty))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier))

View File

@ -17,9 +17,6 @@
(Empty)))
(
(Return
(MemberAccess
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))))
{ (Identifier)
->(Identifier) })))
(Empty)))

View File

@ -17,9 +17,6 @@
(Empty)))
(
(Return
(MemberAccess
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))))
{ (Identifier)
->(Identifier) })))
(Empty)))

View File

@ -16,7 +16,5 @@
(Empty)))
(
(Return
(MemberAccess
(Identifier)
(Identifier)))))
(Identifier))))
(Empty)))

View File

@ -16,7 +16,5 @@
(Empty)))
(
(Return
(MemberAccess
(Identifier)
(Identifier)))))
(Identifier))))
(Empty)))

View File

@ -5,19 +5,13 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))))

View File

@ -5,19 +5,13 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))))

View File

@ -5,17 +5,11 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))))

View File

@ -5,17 +5,11 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))))

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
{ (TextElement)
->(TextElement) }

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
{ (TextElement)
->(TextElement) }

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
(TextElement)
(Empty))))

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
(TextElement)
(Empty))))

View File

@ -3,6 +3,4 @@
{ (Subscript
{-(Identifier)-}
{-(TextElement)-})
->(MemberAccess
{+(Identifier)+}
{+(Identifier)+}) }))
->(Identifier) }))

View File

@ -1,8 +1,6 @@
(Program
(Delete
{ (MemberAccess
{-(Identifier)-}
{-(Identifier)-})
{ (Identifier)
->(Subscript
{+(Identifier)+}
{+(TextElement)+}) }))

View File

@ -1,5 +1,3 @@
(Program
(Delete
(MemberAccess
(Identifier)
(Identifier))))
(Identifier)))

View File

@ -4,9 +4,7 @@
->(Boolean) }
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty)))))

View File

@ -4,9 +4,7 @@
->(Boolean) }
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty)))))

View File

@ -3,8 +3,6 @@
(Boolean)
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty)))))

View File

@ -3,8 +3,6 @@
(Boolean)
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty)))))

View File

@ -1,161 +1,31 @@
(Program
(Export
(ExportClause
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(Export
(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-}
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
{ (Empty)
->(Identifier) })
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}))
(Export
{(QualifiedExport)->(QualifiedExport)}
{(QualifiedExport)->(QualifiedExport)}
(DefaultExport
(VariableDeclaration
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))))
(DefaultExport
(VariableDeclaration
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
{-(Identifier)-})-}
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
{ (Empty)
->(Identifier) })
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
{ (Identifier)
->(Identifier) })
{+(Export
{+(Function
{+(Empty)+}
{+(Empty)+}
{+(Identifier)+}
{+([])+})+})+}
(Export
(Function
(Empty)
(Empty)
(Empty)
([])))
(Export
{+(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+})+}
{-(Function
{-(Empty)-}
{-(Empty)-}
{-(Identifier)-}
{-([])-})-})
(Export
{+(TextElement)+}
{-(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-})-})
{+(Export
{+(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+})+}
{+(TextElement)+})+}
{+(Export
{+(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+})+}
{+(TextElement)+})+}
{-(Export
{-(TextElement)-})-}
{-(Export
{-(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-})-}
{-(TextElement)-})-}
{-(Export
{-(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-})-}
{-(TextElement)-})-})
{-(Assignment{-(Empty)-}{-(Identifier)-}{-(Identifier)-})-}
(Assignment(Empty)(Identifier)(Identifier))
(Assignment(Empty)(Identifier){(Empty)->(Identifier)})
{+(Assignment{+(Empty)+}{+(Identifier)+}{+(Empty)+})+}
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))))
(DefaultExport
{(Identifier)->(Identifier)})
{+(DefaultExport
{+(Function{+(Empty)+}{+(Empty)+}{+(Identifier)+}{+([])+})+})+}
(DefaultExport
(Function(Empty)(Empty)(Empty)([])))
{+(QualifiedExport)+}
{+(DefaultExport {+(TextElement)+})+}
{+(QualifiedExportFrom {+(Identifier)+})+}
{+(QualifiedExportFrom {+(Identifier)+})+}
{-(DefaultExport
{-(Function{-(Empty)-}{-(Empty)-}{-(Identifier)-}{-([])-})-})-}
{-(QualifiedExport)-}
{-(DefaultExport {-(TextElement)-})-}
{-(QualifiedExportFrom {-(Identifier)-})-}
{-(QualifiedExportFrom {-(Identifier)-})-})

View File

@ -1,153 +1,24 @@
(Program
(Export
(ExportClause
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(Export
(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+}
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Empty) })
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(Export
{(QualifiedExport)->(QualifiedExport)}
{(QualifiedExport)->(QualifiedExport)}
(DefaultExport
(VariableDeclaration
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))))
(DefaultExport
(VariableDeclaration
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Identifier)+})+}
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
{ (Identifier)
->(Empty) })
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
{-(Empty)-})-}
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
{-(Empty)-})-}))
(Export
{ (Identifier)
->(Identifier) })
{-(Export
{-(Function
{-(Empty)-}
{-(Empty)-}
{-(Identifier)-}
{-([])-})-})-}
(Export
(Function
(Empty)
(Empty)
(Empty)
([])))
(Export
{+(Function
{+(Empty)+}
{+(Empty)+}
{+(Identifier)+}
{+([])+})+}
{-(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-})-})
(Export
{+(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+})+}
{-(TextElement)-})
{+(Export
{+(TextElement)+})+}
(Export
(ExportClause
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty)))
{ (TextElement)
->(TextElement) })
(Export
(ExportClause
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-})
{ (TextElement)
->(TextElement) }))
{+(Assignment{+(Empty)+}{+(Identifier)+}{+(Identifier)+})+}
(Assignment(Empty)(Identifier)(Identifier))
(Assignment(Empty)(Identifier){(Identifier)->(Empty)})
{+(Assignment{+(Empty)+}{+(Identifier)+}{+(Empty)+})+}
{-(Assignment{-(Empty)-}{-(Identifier)-}{-(Empty)-})-}
{-(Assignment{-(Empty)-}{-(Identifier)-}{-(Empty)-})-}))
(DefaultExport {(Identifier)->(Identifier)})
{-(DefaultExport {-(Function{-(Empty)-}{-(Empty)-}{-(Identifier)-}{-([])-})-})-}
(DefaultExport (Function(Empty)(Empty)(Empty)([])))
{+(DefaultExport {+(Function{+(Empty)+}{+(Empty)+}{+(Identifier)+}{+([])+})+})+}
{(QualifiedExport)->(QualifiedExport)}
(DefaultExport {(TextElement)->(TextElement)})
{(QualifiedExportFrom {-(Identifier)-})->(QualifiedExportFrom {+(Identifier)+})}
{(QualifiedExportFrom {-(Identifier)-})->(QualifiedExportFrom {+(Identifier)+})})

View File

@ -1,103 +1,20 @@
(Program
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Empty))))
(Export
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))))
(Export
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))))
(Export
(QualifiedExport)
(QualifiedExport)
(DefaultExport
(VariableDeclaration(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))))
(DefaultExport
(VariableDeclaration(Assignment(Empty)(Identifier)(Identifier))(Assignment(Empty)(Identifier)(Identifier))(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))))
(DefaultExport
(Identifier))
(Export
(Function
(Empty)
(Empty)
(Empty)
([])))
(Export
(Function
(Empty)
(Empty)
(Identifier)
([])))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))))
(Export
(DefaultExport
(Function(Empty)(Empty)(Empty)([])))
(DefaultExport
(Function(Empty)(Empty)(Identifier)([])))
(QualifiedExport)
(DefaultExport
(TextElement))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty)))
(TextElement))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Empty)))
(TextElement)))
(QualifiedExportFrom
(Identifier))
(QualifiedExportFrom
(Identifier)))

View File

@ -1,103 +1,14 @@
(Program
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Empty))))
(Export
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))))
(Export
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))))
(Export
(Identifier))
(Export
(Function
(Empty)
(Empty)
(Identifier)
([])))
(Export
(Function
(Empty)
(Empty)
(Empty)
([])))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))))
(Export
(TextElement))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty)))
(TextElement))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Empty)))
(TextElement)))
(QualifiedExport)
(QualifiedExport)
(DefaultExport
(VariableDeclaration(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))))
(DefaultExport
(VariableDeclaration(Assignment(Empty)(Identifier)(Identifier))(Assignment(Empty)(Identifier)(Identifier))(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))))
(DefaultExport (Identifier))
(DefaultExport (Function(Empty)(Empty)(Identifier)([])))
(DefaultExport (Function(Empty)(Empty)(Empty)([])))
(QualifiedExport)
(DefaultExport (TextElement))
(QualifiedExportFrom (Identifier))
(QualifiedExportFrom (Identifier)))

View File

@ -31,9 +31,7 @@
{+(Empty)+})+})+}
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty))

View File

@ -31,9 +31,7 @@
{-(Empty)-})-})-}
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty))

View File

@ -23,9 +23,7 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty))
(Return

View File

@ -23,9 +23,7 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty))
(Return

View File

@ -1,9 +1,7 @@
(Program
(If
{ (Identifier)
->(MemberAccess
{+(Identifier)+}
{+(Identifier)+}) }
->(Identifier) }
(
(Call
(Identifier)

View File

@ -1,8 +1,6 @@
(Program
(If
{ (MemberAccess
{-(Identifier)-}
{-(Identifier)-})
{ (Identifier)
->(Identifier) }
(
(Call

View File

@ -1,8 +1,6 @@
(Program
(If
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(
(Call
(Identifier)

View File

@ -1,49 +1,41 @@
(Program
{+(Import
{+(TextElement)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+}
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+}
(Import
{ (Identifier)
->(Identifier) })
(QualifiedImport
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })
{ (Import
{-(TextElement)-})
{-(Identifier)-})
->(Import
{+(TextElement)+}) }
{+(
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+})+}
{+(
{+(Import
{+(TextElement)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+})+}
{+(Import
{+(TextElement)+})+}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-}
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-}
{-(
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-})-}
{-(
{-(Import
{-(TextElement)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-})-}
{-(Import
{-(TextElement)-})-})
{+(Identifier)+}) }
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
(
(Import
{ (Identifier)
->(Identifier) })
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) })
(
(Import
{ (Identifier)
->(Identifier) })
(QualifiedImport
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))
(Import
{ (Identifier)
->(Identifier) }))

View File

@ -1,49 +1,41 @@
(Program
{+(Import
{+(TextElement)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+}
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+}
{+(
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+})+}
{+(
{+(Import
{+(TextElement)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+})+}
{+(Import
{+(TextElement)+})+}
{-(Import
{-(TextElement)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-}
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-}
{-(
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-})-}
{-(
{-(Import
{-(TextElement)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-})-}
{-(Import
{-(TextElement)-})-})
(Import
{ (Identifier)
->(Identifier) })
(QualifiedImport
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
(
(Import
{ (Identifier)
->(Identifier) })
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) })
(
(Import
{ (Identifier)
->(Identifier) })
(QualifiedImport
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))
(Import
{ (Identifier)
->(Identifier) }))

View File

@ -1,25 +1,25 @@
(Program
(Import
(TextElement))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)
(Identifier))
(Import
(TextElement))
(Identifier))
(Import
(TextElement))
(Identifier))
(Import
(TextElement))
(Identifier))
(
(Import
(TextElement))
(Identifier))
(Import
(TextElement)))
(Identifier)))
(
(Import
(TextElement))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)
(Identifier)))
(Import
(TextElement)))
(Identifier)))

View File

@ -1,25 +1,25 @@
(Program
(Import
(TextElement))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)
(Identifier))
(Import
(TextElement))
(Identifier))
(Import
(TextElement))
(Identifier))
(Import
(TextElement))
(Identifier))
(
(Import
(TextElement))
(Identifier))
(Import
(TextElement)))
(Identifier)))
(
(Import
(TextElement))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)
(Identifier)))
(Import
(TextElement)))
(Identifier)))

View File

@ -1,7 +1,5 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Float)
->(Float) }))

View File

@ -1,7 +1,5 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Float)
->(Float) }))

View File

@ -1,6 +1,4 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)))

View File

@ -1,6 +1,4 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)))

View File

@ -1,5 +1,3 @@
(Program
(MemberAccess
(Identifier)
{ (Identifier)
->(Identifier) }))
{ (Identifier)
->(Identifier) })

View File

@ -1,5 +1,3 @@
(Program
(MemberAccess
(Identifier)
{ (Identifier)
->(Identifier) }))
{ (Identifier)
->(Identifier) })

View File

@ -1,4 +1,2 @@
(Program
(MemberAccess
(Identifier)
(Identifier)))
(Identifier))

View File

@ -1,4 +1,2 @@
(Program
(MemberAccess
(Identifier)
(Identifier)))
(Identifier))

View File

@ -1,8 +1,6 @@
(Program
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
{ (TextElement)
->(TextElement) }

View File

@ -1,8 +1,6 @@
(Program
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
{ (TextElement)
->(TextElement) }

View File

@ -1,8 +1,6 @@
(Program
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(TextElement)
(Empty)))

View File

@ -1,8 +1,6 @@
(Program
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(TextElement)
(Empty)))

View File

@ -38,16 +38,12 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty)))))))

View File

@ -38,16 +38,12 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty)))))))

View File

@ -38,14 +38,10 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty)))))))

View File

@ -38,14 +38,10 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty)))))))

View File

@ -1,19 +1,11 @@
(Program
{+(Assignment
{+(MemberAccess
{+(Identifier)+}
{+(Identifier)+})+}
{+(Identifier)+}
{+(If
{+(Identifier)+}
{+(Identifier)+}
{+(MemberAccess
{+(Identifier)+}
{+(Identifier)+})+}
{+(MemberAccess
{+(Identifier)+}
{+(Identifier)+})+}
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+}
{+(Identifier)+})+}
{+(Identifier)+})+})+})+}
{-(If
{-(Identifier)-}

View File

@ -4,18 +4,10 @@
{+(Identifier)+}
{+(Identifier)+})+}
{-(Assignment
{-(MemberAccess
{-(Identifier)-}
{-(Identifier)-})-}
{-(Identifier)-}
{-(If
{-(Identifier)-}
{-(Identifier)-}
{-(MemberAccess
{-(Identifier)-}
{-(Identifier)-})-}
{-(MemberAccess
{-(Identifier)-}
{-(Identifier)-})-}
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-}
{-(Identifier)-})-}
{-(Identifier)-})-})-})-})

View File

@ -1,17 +1,9 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(If
(Identifier)
(Identifier)
(MemberAccess
(Identifier)
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(MemberAccess
(MemberAccess
(Identifier)
(Identifier))
(Identifier)))))

View File

@ -1 +1,13 @@
(Program(Function(Empty)(Empty)(Identifier)((VariableDeclaration(Assignment(Empty)(Identifier)(Float)))(Yield(Identifier)))))
(Program
(Function
(Empty)
(Empty)
(Identifier)
(
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Float)))
(Yield
(Identifier)))))

View File

@ -1,30 +1,24 @@
(Program
(Export
{+(Function
{+(Empty)+}
{+(Empty)+}
{+(Identifier)+}
{+(RequiredParameter
(DefaultExport
{(Class
{-(Identifier)-}
{-([])-})
->
(Function
{+(Empty)+}
{+(Empty)+}
{+(Annotation
{+(PredefinedType)+})+}
{+(Assignment
{+(Identifier)+}
{+(Empty)+})+})+}
{+(RequiredParameter
{+(Empty)+}
{+(Empty)+}
{+(Annotation
{+(PredefinedType)+})+}
{+(Assignment
{+(Identifier)+}
{+(Empty)+})+})+}
{+(
{+(Return
{+(Identifier)+}
{+(RequiredParameter
{+(Empty)+}
{+(Empty)+}
{+(Annotation{+(PredefinedType)+})+}
{+(Assignment{+(Identifier)+}{+(Empty)+})+})+}
{+(RequiredParameter
{+(Empty)+}
{+(Empty)+}
{+(Annotation{+(PredefinedType)+})+}
{+(Assignment{+(Identifier)+}{+(Empty)+})+})+}
{+({+(Return
{+(Hash
{+(ShorthandPropertyIdentifier)+}
{+(ShorthandPropertyIdentifier)+})+})+})+})+}
{-(Class
{-(Identifier)-}
{-([])-})-}))
{+(ShorthandPropertyIdentifier)+})+})+})+})}))

View File

@ -1,30 +1,10 @@
(Program
(Export
{+(Class
{+(Identifier)+}
{+([])+})+}
{-(Function
{-(Empty)-}
{-(Empty)-}
{-(Identifier)-}
{-(RequiredParameter
(DefaultExport
{(Function
{-(Empty)-}
{-(Empty)-}
{-(Annotation
{-(PredefinedType)-})-}
{-(Assignment
{-(Identifier)-}
{-(Empty)-})-})-}
{-(RequiredParameter
{-(Empty)-}
{-(Empty)-}
{-(Annotation
{-(PredefinedType)-})-}
{-(Assignment
{-(Identifier)-}
{-(Empty)-})-})-}
{-(
{-(Return
{-(Hash
{-(ShorthandPropertyIdentifier)-}
{-(ShorthandPropertyIdentifier)-})-})-})-})-}))
{-(Identifier)-}
{-(RequiredParameter{-(Empty)-}{-(Empty)-}{-(Annotation{-(PredefinedType)-})-}{-(Assignment{-(Identifier)-}{-(Empty)-})-})-}
{-(RequiredParameter{-(Empty)-}{-(Empty)-}{-(Annotation{-(PredefinedType)-})-}{-(Assignment{-(Identifier)-}{-(Empty)-})-})-}
{-({-(Return{-(Hash{-(ShorthandPropertyIdentifier)-}{-(ShorthandPropertyIdentifier)-})-})-})-})
->(Class{+(Identifier)+}{+([])+})}))

View File

@ -1,5 +1,5 @@
(Program
(Export
(DefaultExport
(Class
(Identifier)
([]))))

View File

@ -1,5 +1,5 @@
(Program
(Export
(DefaultExport
(Function
(Empty)
(Empty)

View File

@ -0,0 +1 @@
*.js

View File

@ -0,0 +1,5 @@
export { baz }
function baz() {
return "this is the baz function"
}

View File

@ -1,7 +1,5 @@
export function bar() {
return "this is the bar function"
}
export { baz } from "a"
export default function () {
return "this is the defaultExport function"
function bar() {
return "this is the bar function";
}

View File

@ -1,5 +1,5 @@
// Use `tsc test.ts foo.ts && node test.js` to test evaluation
// Use `tsc main.ts foo.ts && node main.js` to test evaluation
import * as name from "./foo";
import { baz as bar } from "foo";
console.log(name.bar())
bar()

View File

@ -17,9 +17,6 @@
(Empty)))
(
(Return
(MemberAccess
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))))
{ (Identifier)
->(Identifier) })))
(Empty)))

View File

@ -17,9 +17,6 @@
(Empty)))
(
(Return
(MemberAccess
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))))
{ (Identifier)
->(Identifier) })))
(Empty)))

View File

@ -16,7 +16,5 @@
(Empty)))
(
(Return
(MemberAccess
(Identifier)
(Identifier)))))
(Identifier))))
(Empty)))

View File

@ -16,7 +16,5 @@
(Empty)))
(
(Return
(MemberAccess
(Identifier)
(Identifier)))))
(Identifier))))
(Empty)))

View File

@ -5,19 +5,13 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))))

View File

@ -5,19 +5,13 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))))

View File

@ -5,17 +5,11 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))))

View File

@ -5,17 +5,11 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))))

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
{ (TextElement)
->(TextElement) }

Some files were not shown because too many files have changed in this diff Show More