Skip to content

Commit

Permalink
Merge pull request #150 from nLatt/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mindoodoo authored Mar 8, 2023
2 parents 426760c + 7b8f098 commit 2f9db5e
Show file tree
Hide file tree
Showing 133 changed files with 1,662 additions and 1,043 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Haskell CI

on:
pull_request:
branches: [main, develop]
branches: [main, develop, compilation-develop]

permissions:
contents: read
Expand Down Expand Up @@ -38,6 +38,5 @@ jobs:
run: cabal build --enable-tests --enable-benchmarks all
- name: Run tests
run: |
find . -wholename "*glados/glados" -exec cp {} . \;;
cabal test all;
make test;
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ cabal.project.local~
glados
tmp
packagedb
/*.scm
/*.scm
*_lnk
a.out
191 changes: 123 additions & 68 deletions GLaDOS2023.cabal
Original file line number Diff line number Diff line change
@@ -1,93 +1,148 @@
cabal-version: 2.4
name: GLaDOS2023
version: 0.1.0.0
-- A short (one-line) description of the package.
-- synopsis:

-- A longer description of the package.
-- description:

-- A URL where users can report bugs.
-- bug-reports:

-- The license under which the package is released.
-- license:
version: 0.2.0.0
author: Nydragon

-- A copyright notice.
-- copyright:
-- category:
extra-source-files:
CHANGELOG.md
README.md

library
--
-- Compilation
--

library compilation-lib
default-language: Haskell2010
hs-source-dirs: lib
exposed-modules: Parsing,
build-depends: base >= 4.14.1.0, containers >= 0.5.10.2, shared-lib
hs-source-dirs: libraries/compilation-lib
ghc-options: -Wall -debug
exposed-modules:
Parsing.Args,
Parsing.Token,
Parsing.TokenType,
Parsing.Ast,
Parsing.Cpt,
Parsing.Infix,
Exec,
Exec.RuntimeException,
Exec.Function,
Exec.Variables
Exec.Registry,
Exec.Builtins,
Exec.InteractivePrompt
Exec.Eval,
Exec.Utils
Parsing.Token,
Parsing.TokenType,
Compilation.Utils,
Compilation.Compile,
Compilation.CompilationError,
Compilation.Registry,
Compilation.RetVal

-- Compiler
executable glados
default-language: Haskell2010
hs-source-dirs: compiler unit-tests
ghc-options: -Wall -debug
build-depends: base >= 4.14.1.0,
compilation-lib,
shared-lib,
-- Testing deps are here for vscode highlighting purposes
tasty >= 1.4.3,
tasty-discover >= 5.0.0,
tasty-hunit >= 0.10.0.3,
containers >= 0.5.10.2
main-is: Main.hs

hs-source-dirs: lib
build-depends: base >= 4.14.1.0, containers
--
-- Execution
--

library exec-lib
default-language: Haskell2010
build-depends: base >= 4.14.1.0,
containers >=0.5.10.2
hs-source-dirs: libraries/exec-lib
build-depends: base >= 4.14.1.0, shared-lib, containers
ghc-options: -Wall
exposed-modules:
Parser.ReadFile,
Exec.InferType,
Exec.Builtins,
Exec.Infer,
Exec.Instructions,
Exec.RuntimeException,
Exec.Utils,
Exec

executable glados
executable runner
default-language: Haskell2010
hs-source-dirs: app test
main-is: Main.hs
-- Modules included in this executable, other than Main.
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends: base >= 4.14.1.0, tasty >= 1.4.3, tasty-discover >= 5.0.0, tasty-hunit >= 0.10.0.3, containers >=0.5.10.2, GLaDOS2023
hs-source-dirs: runner
build-depends: base >= 4.14.1.0, exec-lib
main-is: Main.hs

--
-- Shared
--

test-suite unitTest
library shared-lib
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: unitTest
build-depends: base >= 4.14.1.0, containers >= 0.5.10.2
hs-source-dirs: libraries/shared-lib
ghc-options: -Wall
exposed-modules:
Instruction,
FunctionBlock,
Utils

--
-- Interactive
--

executable sun-tzu
default-language: Haskell2010
build-depends: base >= 4.14.1.0,
containers,
shared-lib,
compilation-lib,
exec-lib
hs-source-dirs: interactive
main-is: Main.hs
ghc-options: -Wall
other-modules:
Utils

--
-- Tests
--

test-suite unit-tests
default-language: Haskell2010
hs-source-dirs: tests/unit-tests
build-depends: base >=4.14.1.0,
tasty >= 1.4.3,
tasty-discover >= 5.0.0,
tasty-hunit >= 0.10.0.3,
containers >=0.5.10.2,
exec-lib,
compilation-lib,
shared-lib
main-is: TestMain.hs
other-modules: Parsing.ArgsTests,
Parsing.TokenTests,
Parsing.CptTests,
Parsing.AstTests,
Parsing.InfixTests,
ParsingTests,
ExecTests
build-depends: base >=4.14.1.0,
tasty >= 1.4.3,
tasty-discover >= 5.0.0,
tasty-hunit >= 0.10.0.3,
containers >=0.5.10.2,
GLaDOS2023
type: exitcode-stdio-1.0
other-modules:
CompilationLib.Parser.ArgsTests,
CompilationLib.Parser.TokenTests,
CompilationLib.Parser.CptTests,
CompilationLib.Parser.AstTests,
CompilationLib.Parser.InfixTests,
ExecLib.Exec.Infer,
ExecLib.Exec.Instructions,
ExecLib.Exec.Utils,
ExecLib.Parser.ReadFile,
CompilationLib
ExecLib

test-suite integrationTest
test-suite integration-tests
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: integrationTests/
main-is: Main.hs
other-modules: Print
Test
hs-source-dirs: tests/integration-tests
build-depends: base >=4.14.1.0,
ansi-terminal >= 0.11.3,
process >= 1.6.8.0,
filepath >= 1.4.2.1,
directory >= 1.3.3.0,
exitcode >= 0.1.0.0,
GLaDOS2023
ansi-terminal >= 0.11.3,
process >= 1.6.8.0,
filepath >= 1.4.2.1,
directory >= 1.3.3.0,
exitcode >= 0.1.0.0,
exec-lib,
compilation-lib
main-is: Main.hs
type: exitcode-stdio-1.0
other-modules:
Print,
Test
53 changes: 39 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
SHELL := /bin/bash

# Binary Names
COMPILER_NAME = glados
RUNNER_NAME = runner
INTERACTIVE=sun-tzu

all: clean
@cabal run glados -- $(ARGS)

build: clean
@rm -rf ./dist-newstyle
@cabal build glados
@find . -wholename "*glados/glados" -exec cp {} . \;

test: clean
@cabal test --test-show-details=direct
build:
ifeq ($(filter $(COMPILER_NAME),$(MAKECMDGOALS)),$(COMPILER_NAME))
@cabal build $(COMPILER_NAME)
@find . -wholename "*$(COMPILER_NAME)/$(COMPILER_NAME)" -exec ln -fs {} ./$(COMPILER_NAME)_lnk \;
else ifeq ($(filter $(RUNNER_NAME),$(MAKECMDGOALS)),$(RUNNER_NAME))
@cabal build $(RUNNER_NAME)
@find . -wholename "*$(RUNNER_NAME)/$(RUNNER_NAME)" -exec ln -fs {} ./$(RUNNER_NAME)_lnk \;
else
@cabal build $(COMPILER_NAME)
@cabal build $(RUNNER_NAME)
@cabal build $(INTERACTIVE)
@find . -wholename "*$(COMPILER_NAME)/$(COMPILER_NAME)" -exec ln -fs {} ./$(COMPILER_NAME)_lnk \;
@find . -wholename "*$(RUNNER_NAME)/$(RUNNER_NAME)" -exec ln -fs {} ./$(RUNNER_NAME)_lnk \;
@find . -wholename "*$(INTERACTIVE)/$(INTERACTIVE)" -exec ln -fs {} ./$(INTERACTIVE)_lnk \;
endif

unit-test: clean
@cabal run unitTest --test-show-details=direct
clean:
@rm -rf ./dist-newstyle
@rm -f $(RUNNER_NAME)_lnk
@rm -f $(COMPILER_NAME)_lnk

integration-test: clean
@cabal run integrationTest --test-show-details=direct
re: clean build

clean:
@rm -f *.tix
test: clean
ifeq ($(filter unit,$(MAKECMDGOALS)),unit)
@cabal run unit-tests --test-show-details=direct
else ifeq ($(filter integration,$(MAKECMDGOALS)),integration)
make build
@cabal run integration-tests --test-show-details=direct
else
make build
@cabal run unit-tests --test-show-details=direct
@cabal run integration-tests --test-show-details=direct
endif

.PHONY: all build tests integration-test unit-test clean
.PHONY: all build test clean glados
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
- Written in **Haskell**
- **Strict** testing policy
- Continuous integration running tests on every **Pull Request**
- **Over 60** Unit tests and close to **50% coverage**
- **Over 100** Unit tests and close to **50% coverage**
- **Close to 20** Integration tests
- **Abstract Syntax Tree** and **Concrete Parse Tree** implementation
- Standard input reading
- An [ABNF syntax description](./doc/syntax-description.md)
- An [ABNF syntax description for the "compiled" code](./doc/compiled-syntax-description)
- **Infix notations** for operators and custom functions

## Supported Scheme Features
Expand Down
63 changes: 0 additions & 63 deletions app/Main.hs

This file was deleted.

2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages : ./GLaDOS2023.cabal
tests: True
coverage: True
library-coverage: True
library-coverage: False
Loading

0 comments on commit 2f9db5e

Please sign in to comment.