1
1
mirror of https://github.com/github/semantic.git synced 2024-11-27 12:57:49 +03:00

Define the Python prelude using our primitive DSL.

This commit is contained in:
Rob Rix 2018-06-18 09:56:47 -04:00
parent 4c4c8db3f8
commit 5bcc6271ec

View File

@ -10,6 +10,7 @@ import GHC.TypeLits
import qualified Language.Python.Assignment as Python
import qualified Language.Ruby.Assignment as Ruby
import qualified Language.TypeScript.Assignment as TypeScript
import Prologue
class Preluded syntax where
type PreludePath syntax :: Symbol
@ -33,7 +34,11 @@ instance Preluded Ruby.Term where
instance Preluded Python.Term where
type PreludePath Python.Term = "preludes/python.py"
definePrelude = pure ()
definePrelude =
define "print" (lambda (\ v -> do
print <- variable "__semantic_print" >>= deref
void $ call print [variable v]
box unit))
instance Preluded TypeScript.Term where
type PreludePath TypeScript.Term = "preludes/javascript.js"