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:
parent
a3f12e21d1
commit
6a4f9ef5b4
21
Asmblr.cabal
21
Asmblr.cabal
|
@ -2,7 +2,7 @@
|
||||||
-- documentation, see http://haskell.org/cabal/users-guide/
|
-- documentation, see http://haskell.org/cabal/users-guide/
|
||||||
|
|
||||||
-- The name of the package.
|
-- The name of the package.
|
||||||
name: Asmblr
|
name: hackasm
|
||||||
|
|
||||||
-- The package version. See the Haskell package versioning policy (PVP)
|
-- The package version. See the Haskell package versioning policy (PVP)
|
||||||
-- for standards guiding when and how versions should be incremented.
|
-- for standards guiding when and how versions should be incremented.
|
||||||
|
@ -19,7 +19,7 @@ synopsis: Assembler for Hack platform
|
||||||
-- description:
|
-- description:
|
||||||
|
|
||||||
-- URL for the project homepage or repository.
|
-- 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.
|
-- The license under which the package is released.
|
||||||
license: GPL-3
|
license: GPL-3
|
||||||
|
@ -43,27 +43,36 @@ build-type: Simple
|
||||||
|
|
||||||
-- Extra files to be distributed with the package, such as examples or a
|
-- Extra files to be distributed with the package, such as examples or a
|
||||||
-- README.
|
-- README.
|
||||||
-- extra-source-files:
|
extra-source-files: README.md
|
||||||
|
|
||||||
-- Constraint on the version of Cabal needed to build this package.
|
-- Constraint on the version of Cabal needed to build this package.
|
||||||
cabal-version: >=1.10
|
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
|
executable Asmblr
|
||||||
-- .hs or .lhs file containing the Main module.
|
-- .hs or .lhs file containing the Main module.
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
|
|
||||||
-- Modules included in this executable, other than Main.
|
-- Modules included in this executable, other than Main.
|
||||||
-- other-modules:
|
other-modules: RekahSoft.HackAsm.CommandLine
|
||||||
|
|
||||||
-- LANGUAGE extensions used by modules in this package.
|
-- LANGUAGE extensions used by modules in this package.
|
||||||
-- other-extensions:
|
-- other-extensions:
|
||||||
|
|
||||||
-- Other library packages from which modules are imported.
|
-- 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.
|
-- Directories containing source files.
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src/Asmblr
|
||||||
|
|
||||||
-- Base language which the package is written in.
|
-- Base language which the package is written in.
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import Asmblr
|
import RekahSoft.HackAsm.CommandLine
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = defaultMain
|
main = defaultMain
|
|
@ -20,7 +20,7 @@
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
Module : Asmblr
|
Module : RekahSoft.HackAsm.CommandLine
|
||||||
Description : Program that takes a hack assembly and converts it to its
|
Description : Program that takes a hack assembly and converts it to its
|
||||||
machine language representation
|
machine language representation
|
||||||
Copyright : (c) Collin J. Doering, 2015
|
Copyright : (c) Collin J. Doering, 2015
|
||||||
|
@ -31,14 +31,14 @@ Portability : POSIX
|
||||||
|
|
||||||
TODO: describe the assemblers operation in more detail
|
TODO: describe the assemblers operation in more detail
|
||||||
-}
|
-}
|
||||||
module Asmblr (defaultMain) where
|
module RekahSoft.HackAsm.CommandLine (defaultMain) where
|
||||||
|
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.FilePath (dropExtension)
|
import System.FilePath (dropExtension)
|
||||||
import System.Console.GetOpt
|
import System.Console.GetOpt
|
||||||
import System.Environment (getArgs)
|
import System.Environment (getArgs)
|
||||||
|
|
||||||
import Asmblr.Parser
|
import RekahSoft.HackAsm.Parser
|
||||||
|
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
|
|
@ -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
|
|
@ -18,7 +18,7 @@
|
||||||
-- Date: Jun 16, 2015
|
-- Date: Jun 16, 2015
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
Module : Asmblr.Parser
|
Module : RekahSoft.Asmblr.Parser
|
||||||
Description : Parse hack assembly into its machine language representation
|
Description : Parse hack assembly into its machine language representation
|
||||||
Copyright : (c) Collin J. Doering, 2015
|
Copyright : (c) Collin J. Doering, 2015
|
||||||
License : GPL-3
|
License : GPL-3
|
||||||
|
@ -28,7 +28,7 @@ Portability : POSIX
|
||||||
|
|
||||||
TODO: describe the assemblers operation in more detail
|
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.ParserCombinators.Parsec
|
||||||
import Text.Parsec.Prim (modifyState)
|
import Text.Parsec.Prim (modifyState)
|
Loading…
Reference in New Issue