-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial attempt at docassemble output, not working yet.
- Loading branch information
Showing
4 changed files
with
73 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# l4version 0.3.4 | ||
|
||
lexicon | ||
#myNumber -> number_2_N | ||
is_legal -> legal_1_A | ||
Business -> business_1_N | ||
|
||
class Business { | ||
name: String | ||
uen: String | ||
someNum: Int | ||
} | ||
|
||
-- the above should be enough information to set up a DocAssemble interview. | ||
|
||
decl myNumber : Int | ||
|
||
decl myBusiness : Business | ||
|
||
-- okay, how do we say that myBusiness is called "MegaCorp"? | ||
|
||
decl is_legal : Business -> Bool | ||
|
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,30 @@ | ||
module ToGF where | ||
|
||
import Syntax | ||
import Prop -- the generated Haskell abstract syntax from the GF | ||
import Paths_baby_l4 | ||
import System.Environment (withArgs) | ||
import Control.Monad (forM_) | ||
import Text.Printf (printf) | ||
|
||
-- prettyprinting | ||
|
||
-- import some sort of YAML library so we aren't just doing all the prettyprinting ourselves | ||
-- import some sort of Python library, ditto | ||
|
||
createYAML :: (Show ct, Show et) => Program ct et -> IO [String] | ||
createYAML (Program lexicon _2 _3 _4 _5) = do | ||
return $ [ "---" ] | ||
|
||
nlg :: (Show ct, Show et) => Program ct et -> IO () | ||
nlg prog = do | ||
yamlstrings <- createYAML prog | ||
putStrLn <$> yamlstrings | ||
sequence_ [ prop | ||
| prop <- program2prop prog | ||
] | ||
|
||
program2prop :: (Show ct, Show et) => Program ct et -> String | ||
program2prop e = show e | ||
|
||
-- later, convert "class" definitions to corresponding YAML/Python bitsies. |