Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.

Commit

Permalink
Initial Breakout into seperate repo
Browse files Browse the repository at this point in the history
  • Loading branch information
lenary committed Nov 13, 2014
0 parents commit 39a0694
Show file tree
Hide file tree
Showing 6 changed files with 510 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
dist
cabal-dev
.cabal-sandbox
cabal.sandbox.config
*.ibc
*.o
*.a
*.so
*.dll
*.dylib
*.swp
*~
.DS_Store
.hpc
*.tix
custom.mk
tags
TAGS
src/Version_idris.hs
30 changes: 30 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2014, Archibald Samuel Elliott

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of Archibald Samuel Elliott nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 changes: 41 additions & 0 deletions Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module Main where

import Idris.Core.TT
import Idris.AbsSyntax
import Idris.ElabDecls
import Idris.REPL

import IRTS.Compiler
import IRTS.CodegenErlang

import System.Environment
import System.Exit

import Paths_idris

data Opts = Opts { inputs :: [FilePath],
output :: FilePath }

showUsage = do putStrLn "Usage: idris-erlang <ibc-files> [-o <output-file>]"
exitWith ExitSuccess

getOpts :: IO Opts
getOpts = do xs <- getArgs
return $ process (Opts [] "idris.erl") xs
where
process opts ("-o":o:xs) = process (opts {output = o}) xs
process opts (x:xs) = process (opts {inputs = x:inputs opts}) xs
process opts [] = opts

erl_main :: Opts -> Idris ()
erl_main opts = do elabPrims
loadInputs (inputs opts) Nothing
mainProg <- elabMain
ir <- compile (Via "erlang") (output opts) mainProg
runIO $ codegenErlang ir

main :: IO ()
main = do opts <- getOpts
if (null (inputs opts))
then showUsage
else runMain (erl_main opts)
2 changes: 2 additions & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
44 changes: 44 additions & 0 deletions idris-erlang.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
-- Initial idris-erlang.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/

name: idris-erlang
version: 0.0.1.0
synopsis: Erlang Backend for the Idris Compiler
-- description:
license: BSD3
license-file: LICENSE
author: Archibald Samuel Elliott
maintainer: [email protected]
-- copyright:
category: Compilers/Interpreters, Dependent Types
build-type: Simple
-- extra-source-files:
cabal-version: >=1.8

executable idris-erlang
main-is: Main.hs
hs-source-dirs: src
other-modules: IRTS.CodegenErlang
build-depends: base >=4.6 && <4.7
, idris
, mtl
, transformers

if os(linux)
cpp-options: -DLINUX
build-depends: unix < 2.8
if os(freebsd)
cpp-options: -DFREEBSD
build-depends: unix < 2.8
if os(dragonfly)
cpp-options: -DDRAGONFLY
build-depends: unix < 2.8
if os(darwin)
cpp-options: -DMACOSX
build-depends: unix < 2.8
if os(windows)
cpp-options: -DWINDOWS
build-depends: Win32 < 2.4

ghc-prof-options: -auto-all -caf-all
ghc-options: -threaded -rtsopts -funbox-strict-fields
Loading

0 comments on commit 39a0694

Please sign in to comment.