Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell #71

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
aa7659e
Clean repository
BYVoid Oct 21, 2014
0293abe
Add package definition and BatshAst
BYVoid Oct 22, 2014
79a9a9f
Skeleton of lexer
BYVoid Oct 23, 2014
125b226
Complete lexer
BYVoid Oct 24, 2014
7c6cb95
Add unit test for lexer
BYVoid Oct 24, 2014
2b1bfd2
Add BatshLex.scanTokens
BYVoid Oct 25, 2014
9e6547c
Skeleton of BatshParser
BYVoid Oct 25, 2014
e81afa9
Parsing rules: toplevel, statement, list
BYVoid Oct 26, 2014
5b15daf
Parsing rules: statements, expressions, function
BYVoid Oct 26, 2014
1db7f81
Resolve reduce/reduce confilits
BYVoid Oct 27, 2014
dc64c9a
Parsing rules: binary expressions, if, while
BYVoid Oct 27, 2014
5d6eb17
Unit test for BatshParser
BYVoid Oct 27, 2014
aac4234
Code file parsing test
BYVoid Oct 28, 2014
bc29c7a
Reorganize package hierarchy
BYVoid Oct 28, 2014
65c2b9f
Code generation (Batsh formatter)
BYVoid Oct 29, 2014
0350d96
Command line parser
BYVoid Oct 30, 2014
8014a96
Code generation in command line
BYVoid Oct 30, 2014
55455a6
Define operator precedences in order to reduce parentheses
BYVoid Oct 30, 2014
658cea4
Implement unit test for batsh code generator
BYVoid Oct 30, 2014
e96bb86
Script for updating unit tests & more unit tests
BYVoid Oct 31, 2014
11e22e8
Render indention correctly
BYVoid Oct 31, 2014
3c44bcf
Add operatorStr for type class Operator
BYVoid Oct 31, 2014
12b433f
Fix function and indention rendering
BYVoid Nov 2, 2014
ecffeb7
Fix library and executable dependency
BYVoid Nov 2, 2014
69b18b8
Rename Lexer.True to Lexer.TTrue (TFalse)
BYVoid Nov 2, 2014
fe262a3
Explicitly specify versions of all dependencies
BYVoid Nov 2, 2014
6c8e33a
Add Travis-CI configuration
BYVoid Nov 2, 2014
5df414d
Add more unit test
BYVoid Nov 2, 2014
8bb3eac
Use newtype instead of type to define Ast.Program
BYVoid Nov 2, 2014
6679c3b
Symbol table
BYVoid Nov 2, 2014
475a15b
Break UnitTest.hs into files
BYVoid Nov 3, 2014
abb861f
Output symbol table if --symbols is set
BYVoid Nov 3, 2014
b008210
Symbol table with hierarchy
BYVoid Nov 3, 2014
44bfae8
Symbol table file unit test
BYVoid Nov 3, 2014
a1d4a6d
Not extract global symbols defined in functions to global scope
BYVoid Nov 4, 2014
bb30386
Test SymbolTable errors
BYVoid Nov 4, 2014
956c7ae
Polymorphic abstract syntax tree
BYVoid Nov 4, 2014
6bd2339
Merge branch 'master' of github.com:BYVoid/batsh-haskell
BYVoid Nov 5, 2014
8694339
Use monadic lexer to keep positions of tokens
BYVoid Nov 5, 2014
c71f271
Use polymorphic abstract syntax tree with annotation
BYVoid Nov 5, 2014
4a5855e
Add position annotation to Ast
BYVoid Nov 5, 2014
069b7af
Make Generator polymorphic
BYVoid Nov 5, 2014
572735d
Varidic parameter build instead of mconcat
BYVoid Nov 6, 2014
68515b7
Split Token from Lexer
BYVoid Nov 6, 2014
4e7ce08
Hide catch from Prelude in SymbolTableTest
BYVoid Nov 6, 2014
d445cfa
Specify build-tools alex >= 3.1.3, happy >= 1.19.4
BYVoid Nov 6, 2014
3b15635
Skeleton of TypeCheck
BYVoid Nov 7, 2014
050bb5d
Use record to rewrite Ast
BYVoid Nov 7, 2014
ae5ca3e
TypeCheck w.i.p
BYVoid Nov 7, 2014
b8577da
TypeCheck and unit test
BYVoid Nov 10, 2014
069924f
TypeCheck cont.
BYVoid Nov 11, 2014
b29e75f
Output typed ast with --type
BYVoid Nov 11, 2014
60b7b24
TypeCheck done & test files
BYVoid Nov 11, 2014
876d340
Test generated typed ast
BYVoid Nov 11, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
_obuild/
*.sublime*
ocp-build.root*
tests/oUnit*
batsh
oUnit-anon.cache
dist
cabal-dev
*.o
*.hi
*.chi
*.chs.h
.virtualenv
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
cabal.config
/batsh
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: haskell
ghc:
- 7.6
- 7.4
install:
- cabal install --only-dependencies --enable-tests
- cabal install alex-3.1.3
- cabal install happy-1.19.4
39 changes: 12 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
build: _obuild
ocp-build build batsh
ln -sf _obuild/batsh/batsh.asm batsh
batsh: dist/build/batsh/batsh
ln -sf dist/build/batsh/batsh batsh

LIBDIR=$(CAML_LD_LIBRARY_PATH)/..
BATSHDIR=$(LIBDIR)/batsh
test:
cabal build
cabal test

install: build
ocp-build install batsh-lib batsh -install-lib "$(LIBDIR)"
# This is an unly wordaround for fixing the generated META file
sed -i 's/ camlp4lib//g' "$(LIBDIR)/META.batsh"
sed -i 's/ camlp4lib//g' "$(LIBDIR)/META.batsh-lib"
dist:
cabal configure --enable-tests

uninstall:
ocp-build uninstall
dist/build/batsh/batsh: dist
cabal build

test: build
ocp-build build test
@./_obuild/test/test.asm

update: build
node scripts/update.js | bash

_obuild:
ocp-build init
.PHONY: clean test

clean:
ocp-build clean

distclean:
rm -rf _obuild

.PHONY: build
cabal clean
rm -f batsh
219 changes: 0 additions & 219 deletions README.md

This file was deleted.

43 changes: 43 additions & 0 deletions batsh.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Name: batsh
Version: 0.1.0
Cabal-Version: >= 1.8
License: MIT
Author: Carbo Kuo
Homepage: https://github.com/BYVoid/Batsh
Bug-Reports: https://github.com/BYVoid/Batsh/issues
Category: Compiler
Synopsis: A language that compiles to Bash and Windows Batch
Build-Type: Simple

Library
Hs-Source-Dirs: library
Build-Depends: array, base, bytestring == 0.10.4.0, containers >= 0.5
Build-Tools: alex >= 3.1.3, happy >= 1.19.4
Exposed-Modules: Batsh,
Batsh.Ast,
Batsh.Ast.Poly,
Batsh.Ast.Typed,
Batsh.Generator,
Batsh.Lexer,
Batsh.Parser,
Batsh.SymbolTable,
Batsh.Token,
Batsh.TypeCheck

Executable batsh
Main-Is: Main.hs
Hs-Source-Dirs: executable
Build-Depends: base, batsh,
optparse-applicative == 0.11.0.1,
pretty-show == 1.6.8

Test-Suite unit-test
Type: exitcode-stdio-1.0
Main-Is: UnitTest.hs
Hs-Source-Dirs: test
Build-Depends: base,
batsh,
containers >= 0.5,
test-framework == 0.8.0.3,
test-framework-hunit == 0.3.0.1,
HUnit == 1.2.5.2
Loading