forked from axellang/axel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
797 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ cabal.project.local | |
|
||
.DS_Store | ||
|
||
axelTemp | ||
resources/autogenerated/* | ||
|
||
ctags | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
force-trailing-newline: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
-- This is just an example, and, since it's partial, is NOT advised for actual use. | ||
(defmacro' when | ||
(([condition body]) (pure [`(if ,condition ,body (error "WHEN"))]))) | ||
(([condition body]) (pure [`(if ~condition ~body (error "WHEN"))]))) | ||
|
||
(defmacro defmacro' | ||
((exprs) | ||
(pure [`(defmacro ,@exprs)]))) | ||
((exprs) | ||
(pure [`(defmacro ~@exprs)]))) | ||
|
||
(defmacro if | ||
(([cond true false]) | ||
(pure [`(case ,cond | ||
(True ,true) | ||
(False ,false))]))) | ||
(([cond true false]) | ||
(pure [`(case ~cond | ||
(True ~true) | ||
(False ~false))]))) | ||
|
||
(defmacro quasiquote | ||
(([(SExpression xs)]) | ||
(let ((quasiquoteElem (fn (x) (case x | ||
((SExpression ['unquote x]) | ||
(SExpression ['list x])) | ||
((SExpression ['unquote-splicing x]) | ||
x) | ||
(atom | ||
(SExpression | ||
['list | ||
(SExpression ['quasiquote atom])])))))) | ||
(pure [(SExpression ['SExpression (SExpression ['concat (SExpression (: 'list (map quasiquoteElem xs)))])])]))) | ||
(([atom]) (pure [(SExpression (list 'quote atom))]))) | ||
(([(AST.SExpression xs)]) | ||
(let ((quasiquoteElem (fn (x) (case x | ||
((AST.SExpression ['unquote x]) | ||
(AST.SExpression ['list x])) | ||
((AST.SExpression ['unquoteSplicing x]) | ||
x) | ||
(atom | ||
(AST.SExpression | ||
['list | ||
(AST.SExpression ['quasiquote atom])])))))) | ||
(pure [(AST.SExpression ['AST.SExpression (AST.SExpression ['concat (AST.SExpression (: 'list (map quasiquoteElem xs)))])])]))) | ||
(([atom]) (pure [(AST.SExpression ['quote atom])]))) | ||
|
||
(= main (IO Unit) | ||
(() (when (== 1 1) (putStrLn "Hi!")))) | ||
(() (if (== 1 1) (putStrLn "Hi!") (putStrLn "wat")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module MacroDefinitionAndEnvironment where | ||
|
||
import qualified Axel.Parse.AST as AST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Scaffold where | ||
|
||
import Axel.Parse.AST | ||
import qualified MacroDefinitionAndEnvironment as MacroDefinitionAndEnvironment | ||
|
||
main :: IO () | ||
main = do | ||
result <- | ||
MacroDefinitionAndEnvironment.%%%MACRO_NAME%%% %%%ARGUMENTS%%% | ||
putStrLn $ unlines $ map toAxel result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.