cimbul / hasklog Goto Github PK
View Code? Open in Web Editor NEWA toy Prolog interpreter/compiler written in Haskell
License: MIT License
A toy Prolog interpreter/compiler written in Haskell
License: MIT License
The tests for the Hasklog.Interpreter module currently only cover unification. Test the actual interpreter.
Pick a CI service and configure:
Github doesn't support math in ReStructuredText. Deploy the documentation to somewhere that does, or convert it to Markdown.
Add a simple WAM-to-LLVM compiler. Don't worry too much about optimization. Focus on something basic that works so we can iterate on it.
Helpful resources:
Investigate Haskell formatters like Stylish, HIndent, and Brittany, and see if I can stand any of them.
I've been building this with Stack for a while. Update the old instructions in Manual.rst
that reference Cabal.
Currently, _
is treated like any other atom, so if you write a pattern like foo(_, _)
, it will unify foo(A, A)
or foo(B, B)
, but not foo(A, B)
. Treat this like a true wildcard pattern.
Enable the -Worphans
GHC warning and reorganize the code to fix them.
One of the parser tests has been failing for 8 years now. It's probably time to fix it.
test/Hasklog/ParserSpec.hs:83:21:
1) Hasklog.Parser.term, with invalid input, fails to parse ":- a :- b"
expected parse error
but got: CompoundTerm ":-" [CompoundTerm ":-" [Atom "a",Atom "b"]]
"Functor" has different meanings in Prolog and Haskell. Data.functor
and Complier.Functor
make the code confusing and force us to hide Haskell's builtin Functor
in imports. Rename them to something like "PFunctor" or maybe "Phunctor." ๐
Add some end-to-end tests, either written in Prolog itself or based on a transcript of interpreter sessions. Possibly something similar to this ISO conformance test suite, although since this implementation doesn't support I/O or second-order predicates, it will probably need some lifting on the Haskell side.
Make the REPL more user-friendly with some of the features you usually find in a shell:
Have a closer look at SWI-Prolog and friends for some further ideas.
Possibilities:
There aren't any tests for the Hasklog.Compiler module at the moment.
The map of builtins uses an (identifier, fixity) pair as the key, but the builtin functions themselves all take a list of terms, and there is no static guarantee that we are passing the right number of terms. That forces us to define a lot of unnecessary fall-through cases. See if we can make this type-safe with a heterogenous map implementation or some kind of dependent type mechanism.
hasklog/src/Hasklog/Interpreter.hs
Lines 48 to 58 in aa7ff57
The compiler module has a state monad within a state monad to keep track of the allocations of temporary and permanent variables. Consider collapsing this into a single state with a tuple of (temporary, permanent) allocations.
hasklog/src/Hasklog/Compiler.hs
Line 263 in aa7ff57
Since hpc-coveralls is dead, it doesn't look like there's a good automated option for coverage reports. We could publish the HPC report to Github Pages instead.
Add a simple WAM interpreter so we can verify the compiler output makes sense.
Enable the -Wname-shadowing
GHC warning and fix the highlighted issues.
I count about 12 undefined
s in the code. See if we can avoid these with additional type safety.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.