Restructured cabalized project

Moved hack assembly parser into its own library, as this is a more
modular setup and opens the possibility of adding additional front
ends (Eg. a web front end).

Currently there is one executable 'Asmblr' which is the command line
front end. See README.md for more details of its operation.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
Collin J. Doering 2015-06-17 17:53:37 -04:00
parent a3f12e21d1
commit 6a4f9ef5b4
5 changed files with 54 additions and 12 deletions

View File

@ -2,7 +2,7 @@
-- documentation, see http://haskell.org/cabal/users-guide/
-- The name of the package.
name: Asmblr
name: hackasm
-- The package version. See the Haskell package versioning policy (PVP)
-- for standards guiding when and how versions should be incremented.
@ -19,7 +19,7 @@ synopsis: Assembler for Hack platform
-- description:
-- URL for the project homepage or repository.
homepage: http://git.rekahsoft.ca/hack
homepage: http://git.rekahsoft.ca/hackasm
-- The license under which the package is released.
license: GPL-3
@ -43,27 +43,36 @@ build-type: Simple
-- Extra files to be distributed with the package, such as examples or a
-- README.
-- extra-source-files:
extra-source-files: README.md
-- Constraint on the version of Cabal needed to build this package.
cabal-version: >=1.10
library
hs-source-dirs: src/lib
exposed-modules: RekahSoft.HackAsm
RekahSoft.HackAsm.Parser
build-depends: base >=4.8 && <4.9, parsec >=3.1 && <3.2, filepath >=1.4 && <1.5, containers >=0.5 && <0.6
default-language: Haskell2010
executable Asmblr
-- .hs or .lhs file containing the Main module.
main-is: Main.hs
-- Modules included in this executable, other than Main.
-- other-modules:
other-modules: RekahSoft.HackAsm.CommandLine
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
-- Other library packages from which modules are imported.
build-depends: base >=4.8 && <4.9, parsec >=3.1 && <3.2, filepath >=1.4 && <1.5, containers >=0.5 && <0.6
build-depends: base >=4.8 && <4.9, parsec >=3.1 && <3.2, filepath >=1.4 && <1.5, containers >=0.5 && <0.6, hackasm
-- Directories containing source files.
hs-source-dirs: src
hs-source-dirs: src/Asmblr
-- Base language which the package is written in.
default-language: Haskell2010

View File

@ -19,7 +19,7 @@
module Main where
import Asmblr
import RekahSoft.HackAsm.CommandLine
main :: IO ()
main = defaultMain

View File

@ -20,7 +20,7 @@
----------------------------------------------------------------------------
{-|
Module : Asmblr
Module : RekahSoft.HackAsm.CommandLine
Description : Program that takes a hack assembly and converts it to its
machine language representation
Copyright : (c) Collin J. Doering, 2015
@ -31,14 +31,14 @@ Portability : POSIX
TODO: describe the assemblers operation in more detail
-}
module Asmblr (defaultMain) where
module RekahSoft.HackAsm.CommandLine (defaultMain) where
import System.IO
import System.FilePath (dropExtension)
import System.Console.GetOpt
import System.Environment (getArgs)
import Asmblr.Parser
import RekahSoft.HackAsm.Parser
----------------------------------------------------------------------------

View File

@ -0,0 +1,33 @@
-- (C) Copyright Collin J. Doering 2015
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
-- File: HackAsm.hs
-- Author: Collin J. Doering <collin.doering@rekahsoft.ca>
-- Date: Jun 17, 2015
{-|
Module : RekahSoft.Asmblr.Parser
Description : Parse hack assembly into its machine language representation
Copyright : (c) Collin J. Doering, 2015
License : GPL-3
Maintainer : collin.doering@rekahsoft.ca
Stability : stable
Portability : POSIX
TODO: describe the assemblers operation in more detail
-}
module RekahSoft.HackAsm (parseHackAsm, parseHackAsmFile) where
import RekahSoft.HackAsm.Parser

View File

@ -18,7 +18,7 @@
-- Date: Jun 16, 2015
{-|
Module : Asmblr.Parser
Module : RekahSoft.Asmblr.Parser
Description : Parse hack assembly into its machine language representation
Copyright : (c) Collin J. Doering, 2015
License : GPL-3
@ -28,7 +28,7 @@ Portability : POSIX
TODO: describe the assemblers operation in more detail
-}
module Asmblr.Parser (parseHackAsm, parseHackAsmFile) where
module RekahSoft.HackAsm.Parser (parseHackAsm, parseHackAsmFile) where
import Text.ParserCombinators.Parsec
import Text.Parsec.Prim (modifyState)