added some build stuff
This commit is contained in:
parent
a55ff128af
commit
f0c44b9477
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Makefile
|
||||||
|
Hm
|
||||||
|
dist-newstyle
|
7
LICENSE
Normal file
7
LICENSE
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
ISC License
|
||||||
|
|
||||||
|
Copyright 2022 depsterr <depster at protonmail dot com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2
app/Main.hs
Normal file
2
app/Main.hs
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
main :: IO ()
|
||||||
|
main = pure ()
|
31
hm.cabal
Normal file
31
hm.cabal
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
cabal-version: 2.4
|
||||||
|
name: hm
|
||||||
|
version: 0.1.0.0
|
||||||
|
synopsis: toy programming language
|
||||||
|
-- description:
|
||||||
|
homepage: https://githug.xyz/depsterr/hm
|
||||||
|
-- bug-reports:
|
||||||
|
license: ISC
|
||||||
|
license-file: LICENSE
|
||||||
|
author: depsterr
|
||||||
|
maintainer: depsterr@protonmail.com
|
||||||
|
-- copyright:
|
||||||
|
category: Programming Language
|
||||||
|
|
||||||
|
library
|
||||||
|
ghc-options: -Werror=incomplete-patterns -Wall -fno-warn-name-shadowing
|
||||||
|
, Simple.CC
|
||||||
|
build-tool-depends: alex:alex >= 3.0, happy:happy >= 1.19.5
|
||||||
|
build-depends: base >=4
|
||||||
|
, array
|
||||||
|
, containers
|
||||||
|
, transformers
|
||||||
|
, mtl
|
||||||
|
hs-source-dirs: src
|
||||||
|
default-language: Haskell2010
|
||||||
|
|
||||||
|
executable sexprml
|
||||||
|
main-is: Main.hs
|
||||||
|
build-depends: base >=4, hm
|
||||||
|
hs-source-dirs: app
|
||||||
|
default-language: Haskell2010
|
24
hm.cf
24
hm.cf
|
@ -1,4 +1,6 @@
|
||||||
layout toplevel ;
|
layout toplevel ;
|
||||||
|
layout "let" ;
|
||||||
|
layout stop "in" ;
|
||||||
|
|
||||||
entrypoints [Def], Exp ;
|
entrypoints [Def], Exp ;
|
||||||
|
|
||||||
|
@ -7,12 +9,14 @@ token Id ((letter|digit|["[]_"])+) ;
|
||||||
comment "--" ;
|
comment "--" ;
|
||||||
comment "{-" "-}" ;
|
comment "{-" "-}" ;
|
||||||
|
|
||||||
TypeDef. Def ::= "type" TypeSig1 "|" [Decl] ;
|
TypeDef. Def ::= "type" TypeSig1 [Decl] ;
|
||||||
VarDef. Def ::= Id ":" TypeSig ":=" Exp ;
|
VarDef. Def ::= Id ":" TypeSig ":=" Exp ;
|
||||||
separator Def ";" ;
|
separator Def ";" ;
|
||||||
|
|
||||||
Decl. Decl ::= Id ":" TypeSig ;
|
Decl. Decl ::= Id ":" TypeSig ;
|
||||||
separator nonempty Decl "|" ;
|
[]. [Decl] ::= ;
|
||||||
|
(:). [Decl] ::= "|" Decl [Decl];
|
||||||
|
-- todo custom [Decl]
|
||||||
|
|
||||||
TypeFun. TypeSig ::= TypeSig1 "→" TypeSig ;
|
TypeFun. TypeSig ::= TypeSig1 "→" TypeSig ;
|
||||||
TypeApp. TypeSig1 ::= Id [TypeSig2] ;
|
TypeApp. TypeSig1 ::= Id [TypeSig2] ;
|
||||||
|
@ -21,12 +25,16 @@ coercions TypeSig 2;
|
||||||
|
|
||||||
separator nonempty TypeSig2 "" ;
|
separator nonempty TypeSig2 "" ;
|
||||||
|
|
||||||
ExpTyped. Exp ::= Exp1 ":" TypeSig ;
|
ExpLet. Exp ::= "let" "{" [Assign] "}" "in" Exp2 ;
|
||||||
ExpAbs. Exp1 ::= "λ" [Id] "." Exp2 ;
|
ExpTyped. Exp1 ::= Exp2 ":" TypeSig ;
|
||||||
ExpApp. Exp2 ::= Exp3 [Exp3] ;
|
ExpAbs. Exp2 ::= "λ" [Id] "." Exp3 ;
|
||||||
ExpVar. Exp3 ::= Id ;
|
ExpApp. Exp3 ::= Exp4 [Exp4] ;
|
||||||
|
ExpVar. Exp4 ::= Id ;
|
||||||
|
|
||||||
separator nonempty Exp3 "" ;
|
Assign. Assign ::= Ident "=" Exp1 ;
|
||||||
coercions Exp 3;
|
separator nonempty Assign ";" ;
|
||||||
|
|
||||||
|
separator nonempty Exp4 "" ;
|
||||||
|
coercions Exp 4 ;
|
||||||
|
|
||||||
separator nonempty Id "" ;
|
separator nonempty Id "" ;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user