1
1
mirror of https://github.com/anoma/juvix.git synced 2024-07-07 04:36:19 +03:00

Rename MiniJuvix to Juvix (#259)

* Renaming MiniJuvix to Juvix

* Make Ormolu happy

* Make Hlint happy

* Remove redundant imports

* Fix shell tests and add target ci to our Makefile

* Make pre-commit happy
This commit is contained in:
Jonathan Cubides 2022-07-08 07:59:45 -04:00 committed by GitHub
parent 84732b281f
commit 3b3ea45da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
445 changed files with 2435 additions and 2131 deletions

View File

@ -1,4 +1,4 @@
name: MiniJuvix CI
name: The Juvix compiler CI
on:
pull_request:

View File

@ -1,6 +1,6 @@
output=CHANGELOG.md
project=minijuvix
project=juvix
issues=false
pulls=true
user=heliaxdev
user=anoma
verbose=false

4
.gitignore vendored
View File

@ -63,10 +63,10 @@ agda/
agda2hs/
docs/*.html
*.cabal
/src/MiniJuvix/Utils/OldParser.hs
/src/Juvix/Utils/OldParser.hs
CHANGELOG.md
UPDATES-FOR-CHANGELOG.org
.minijuvix-build
.juvix-build
# C Code generation
*.wasm

6
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "minijuvix-stdlib"]
path = minijuvix-stdlib
url = https://github.com/heliaxdev/minijuvix-stdlib.git
[submodule "juvix-stdlib"]
path = juvix-stdlib
url = https://github.com/anoma/juvix-stdlib.git

View File

@ -17,7 +17,7 @@ repos:
- id: mixed-line-ending
exclude: tests/
- repo: https://github.com/heliaxdev/minijuvix
- repo: https://github.com/anoma/juvix
rev: 6f5c3fc2bc70cf65594d3b74fb62e75e8fcfac5b
hooks:
- id: ormolu

View File

@ -64,6 +64,13 @@ docs :
cd docs ; \
sh conv.sh
.PHONY: ci
ci:
make ci-build
make install
make ci-test
make test-shell
.PHONY : build
build:
stack build --fast --jobs $(THREADS)
@ -128,7 +135,7 @@ install-watch:
stack install --fast --jobs $(THREADS) --file-watch
repl:
stack ghci MiniJuvix:lib
stack ghci Juvix:lib
.PHONY : install-pre-commit
install-pre-commit:
@ -143,9 +150,9 @@ pre-commit :
update-submodules :
git submodule foreach git pull origin main
.PHONY : minijuvix-stdlib
minijuvix-stdlib:
git submodule update --init minijuvix-stdlib
.PHONY : juvix-stdlib
juvix-stdlib:
git submodule update --init juvix-stdlib
.PHONY : get-changelog-updates
get-changelog-updates :

View File

@ -1,41 +1,41 @@
* MiniJuvix
* Juvix
#+begin_html
<a href="https://github.com/heliaxdev/MiniJuvix/actions/workflows/ci.yml">
<img alt="CI status" src="https://github.com/heliaxdev/MiniJuvix/actions/workflows/ci.yml/badge.svg" />
<a href="https://github.com/anoma/juvix/actions/workflows/ci.yml">
<img alt="CI status" src="https://github.com/anoma/juvix/actions/workflows/ci.yml/badge.svg" />
</a>
#+end_html
#+begin_html
<a href="https://github.com/heliaxdev/minijuvix/tags">
<img alt="" src="https://img.shields.io/github/v/release/heliaxdev/minijuvix?include_prereleases" />
<a href="https://github.com/anoma/juvix/tags">
<img alt="" src="https://img.shields.io/github/v/release/anoma/juvix?include_prereleases" />
</a>
#+end_html
#+begin_html
<a href="https://github.com/heliaxdev/minijuvix/blob/main/LICENSE">
<a href="https://github.com/anoma/juvix/blob/main/LICENSE">
<img alt="LICENSE" src="https://img.shields.io/badge/license-GPL--3.0--only-blue.svg" />
</a>
#+end_html
#+begin_html
<a href="https://github.com/heliaxdev/minijuvix/actions/workflows/pages/pages-build-deployment"><img
src="https://github.com/heliaxdev/minijuvix/actions/workflows/pages/pages-build-deployment/badge.svg"
<a href="https://github.com/anoma/juvix/actions/workflows/pages/pages-build-deployment"><img
src="https://github.com/anoma/juvix/actions/workflows/pages/pages-build-deployment/badge.svg"
alt="pages-build-deployment" /></a>
#+end_html
#+begin_html
<a href="https://github.com/heliaxdev/MiniJuvix">
<img align="right" width="300" height="300" alt="MiniJuvix Mascot" src="assets/seating-mascot.051c86a.svg" />
<a href="https://github.com/anoma/juvix">
<img align="right" width="300" height="300" alt="Juvix Mascot" src="assets/seating-mascot.051c86a.svg" />
</a>
#+end_html
** Description
MiniJuvix is a research programming language created by [[https://heliax.dev/][Heliax]] as a first step toward creating more robust and reliable alternatives for formally verified smart contracts than existing languages. The MiniJuvix language is constantly evolving, open-source, functional, and statically typed with special support for compiling [[https://anoma.network/blog/validity-predicates/][validity predicates]] to the =C= language, which can be deployed to various distributed ledgers including [[https://anoma.net/][Anoma]].
Juvix is a research programming language created by [[https://heliax.dev/][Heliax]] as a first step toward creating more robust and reliable alternatives for formally verified smart contracts than existing languages. The Juvix language is constantly evolving, open-source, functional, and statically typed with special support for compiling [[https://anoma.network/blog/validity-predicates/][validity predicates]] to the =C= language, which can be deployed to various distributed ledgers including [[https://anoma.net/][Anoma]].
The MiniJuvix programming language allows developers to write programs with a high degree of assurance that they will meet specific standards. This is due to the fact that several static analyses are performed during compilation, including, for example, scope, termination, arity, and type checking. As a result, functional programs, especially validity predicates, can be written with greater confidence that they will be free of runtime errors. [[https://github.com/heliaxdev/minijuvix/tree/main/examples/milestone][Here are some examples of MiniJuvix programs]].
The Juvix programming language allows developers to write programs with a high degree of assurance that they will meet specific standards. This is due to the fact that several static analyses are performed during compilation, including, for example, scope, termination, arity, and type checking. As a result, functional programs, especially validity predicates, can be written with greater confidence that they will be free of runtime errors. [[https://github.com/anoma/juvix/tree/main/examples/milestone][Here are some examples of Juvix programs]].
The language features:
@ -47,48 +47,48 @@ The language features:
- holes in programs
- axioms for non-computable terms
Additionally, the foreign and compile blocks syntax enable developers to compile a program to different backends including the =C= language. The MiniJuvix module system further permits splitting programs into several modules to build libraries which can be later documented by generating HTML files based on the codebase, see for example, [[https://heliaxdev.github.io/minijuvix-stdlib/][the Minijuvix standard library's website]]. For futher details, please refer to [[https://heliaxdev.github.io/minijuvix/][the MiniJuvix book]] which icludes our [[https://heliaxdev.github.io/minijuvix/introduction/changelog.html][latest updates]].
Additionally, the foreign and compile blocks syntax enable developers to compile a program to different backends including the =C= language. The Juvix module system further permits splitting programs into several modules to build libraries which can be later documented by generating HTML files based on the codebase, see for example, [[https://anoma.github.io/juvix-stdlib/][the Juvix standard library's website]]. For futher details, please refer to [[https://anoma.github.io/juvix/][the Juvix book]] which icludes our [[https://anoma.github.io/juvix/introduction/changelog.html][latest updates]].
** Quick Start
To install MiniJuvix, you can download its sources using
To install Juvix, you can download its sources using
[[http://git-scm.com/][Git]] from the
[[https://github.com/anoma/juvix.git][Github repository]]. Then, the
program can be downloaded and installed with the following commands. You
will need to have [[https://haskellstack.org][Stack]] installed.
#+begin_src shell
git clone --recursive https://github.com/heliaxdev/minijuvix.git
cd minijuvix
git clone --recursive https://github.com/anoma/juvix.git
cd juvix
stack install
#+end_src
If the installation succeeds, you must be able to run the =minijuvix=
If the installation succeeds, you must be able to run the =juvix=
command from any location. To get the complete list of commands, please
run =minijuvix --help=.
run =juvix --help=.
** Usage Example
In the following example a MiniJuvix file is compiled using the C backend. The
In the following example a Juvix file is compiled using the C backend. The
result is compiled to WASM using [[https://llvm.org][Clang]] and then executed using [[https://wasmer.io][wasmer]].
NB: Set the =WASI_SYSROOT_PATH= environment variable to the root of the WASI
sysroot. See [[https://heliaxdev.github.io/minijuvix/getting-started/dependencies.html][Installing dependencies]] for instructions on how to install the
sysroot. See [[https://anoma.github.io/juvix/getting-started/dependencies.html][Installing dependencies]] for instructions on how to install the
sysroot.
#+begin_src shell
cd tests/positive/MiniC/HelloWorld
minijuvix compile Input.mjuvix
juvix compile Input.juvix
wasmer Input.wasm
#+end_src
You should see the output: =hello world!=
** The MiniJuvix Book
** The Juvix Book
The MiniJuvix language and related tools are documented in [[https://heliaxdev.github.io/minijuvix/][the MiniJuvix book]].
The Juvix language and related tools are documented in [[https://anoma.github.io/juvix/][the Juvix book]].
** Community
We would love to hear what you think of MiniJuvix! Join us on
We would love to hear what you think of Juvix! Join us on
[[https://discord.gg/nsGaCZzJ][Discord]]

View File

@ -1,18 +1,18 @@
module App where
import GlobalOptions
import MiniJuvix.Pipeline
import MiniJuvix.Prelude hiding (Doc)
import MiniJuvix.Prelude.Error qualified as Error
import MiniJuvix.Prelude.Pretty hiding (Doc)
import Juvix.Pipeline
import Juvix.Prelude hiding (Doc)
import Juvix.Prelude.Error qualified as Error
import Juvix.Prelude.Pretty hiding (Doc)
import System.Console.ANSI qualified as Ansi
data App m a where
ExitMsg :: ExitCode -> Text -> App m ()
ExitMiniJuvixError :: MiniJuvixError -> App m a
ExitJuvixError :: JuvixError -> App m a
ReadGlobalOptions :: App m GlobalOptions
RenderStdOut :: (HasAnsiBackend a, HasTextBackend a) => a -> App m ()
RunPipelineEither :: Sem PipelineEff a -> App m (Either MiniJuvixError a)
RunPipelineEither :: Sem PipelineEff a -> App m (Either JuvixError a)
Say :: Text -> App m ()
makeSem ''App
@ -29,7 +29,7 @@ runAppIO g = interpret $ \case
Say t
| g ^. globalOnlyErrors -> return ()
| otherwise -> embed (putStrLn t)
ExitMiniJuvixError e -> do
ExitJuvixError e -> do
(embed . hPutStrLn stderr . Error.render (not (g ^. globalNoColors)) (g ^. globalOnlyErrors)) e
embed exitFailure
ExitMsg exitCode t -> embed (putStrLn t >> exitWith exitCode)
@ -38,7 +38,7 @@ runPipeline :: Member App r => Sem PipelineEff a -> Sem r a
runPipeline p = do
r <- runPipelineEither p
case r of
Left err -> exitMiniJuvixError err
Left err -> exitJuvixError err
Right res -> return res
newline :: Member App r => Sem r ()

View File

@ -7,7 +7,7 @@ where
import Command
import GlobalOptions
import MiniJuvix.Prelude hiding (Doc)
import Juvix.Prelude hiding (Doc)
import Options.Applicative
import Options.Applicative.Builder.Internal
import Options.Applicative.Help.Pretty
@ -54,13 +54,9 @@ descr =
info
parseCLI
( fullDesc
<> progDesc "The MiniJuvix compiler."
<> headerDoc (Just headDoc)
<> progDesc "The Juvix compiler."
<> footerDoc (Just foot)
)
where
headDoc :: Doc
headDoc = dullblue $ bold $ underline "MiniJuvix help"
foot :: Doc
foot = bold "maintainers: " <> "The MiniJuvix Team"
foot = bold "maintainers: " <> "The Juvix Team"

View File

@ -18,8 +18,8 @@ import Commands.Parse
import Commands.Scope
import Commands.Termination
import GlobalOptions
import MiniJuvix.Prelude hiding (Doc)
import MiniJuvix.Syntax.Concrete.Scoped.Pretty qualified as Scoper
import Juvix.Prelude hiding (Doc)
import Juvix.Syntax.Concrete.Scoped.Pretty qualified as Scoper
import Options.Applicative
data Command
@ -68,28 +68,28 @@ commandCompile =
command "compile" $
info
(addGlobalOptions (Compile <$> parseCompile))
(progDesc "Compile a MiniJuvix file")
(progDesc "Compile a Juvix file")
commandHighlight :: Mod CommandFields CommandGlobalOptions
commandHighlight =
command "highlight" $
info
(addGlobalOptions (pure Highlight))
(progDesc "Highlight a MiniJuvix file")
(progDesc "Highlight a Juvix file")
commandHtml :: Mod CommandFields CommandGlobalOptions
commandHtml =
command "html" $
info
(addGlobalOptions (Html <$> parseHtml))
(progDesc "Generate HTML for a MiniJuvix file")
(progDesc "Generate HTML for a Juvix file")
commandMiniC :: Mod CommandFields CommandGlobalOptions
commandMiniC =
command "minic" $
info
(addGlobalOptions (pure MiniC))
(progDesc "Translate a MiniJuvix file to MiniC")
(progDesc "Translate a Juvix file to MiniC")
commandMicroJuvix :: Mod CommandFields CommandGlobalOptions
commandMicroJuvix =
@ -103,35 +103,35 @@ commandMiniHaskell =
command "minihaskell" $
info
(addGlobalOptions (pure MiniHaskell))
(progDesc "Translate a MiniJuvix file to MiniHaskell")
(progDesc "Translate a Juvix file to MiniHaskell")
commandMonoJuvix :: Mod CommandFields CommandGlobalOptions
commandMonoJuvix =
command "monojuvix" $
info
(addGlobalOptions (pure MonoJuvix))
(progDesc "Translate a MiniJuvix file to MonoJuvix")
(progDesc "Translate a Juvix file to MonoJuvix")
commandParse :: Mod CommandFields CommandGlobalOptions
commandParse =
command "parse" $
info
(addGlobalOptions (Parse <$> parseParse))
(progDesc "Parse a MiniJuvix file")
(progDesc "Parse a Juvix file")
commandScope :: Mod CommandFields CommandGlobalOptions
commandScope =
command "scope" $
info
(addGlobalOptions (Scope <$> parseScope))
(progDesc "Parse and scope a MiniJuvix file")
(progDesc "Parse and scope a Juvix file")
commandShowRoot :: Mod CommandFields CommandGlobalOptions
commandShowRoot =
command "root" $
info
(liftParserCmd (pure DisplayRoot))
(progDesc "Show the root path for a Minijuvix project")
(progDesc "Show the root path for a Juvix project")
commandTermination :: Mod CommandFields CommandGlobalOptions
commandTermination =

View File

@ -3,13 +3,13 @@ module Commands.Compile where
import Data.ByteString qualified as BS
import Data.FileEmbed qualified as FE
import Data.Text.IO qualified as TIO
import MiniJuvix.Prelude hiding (Doc)
import Juvix.Prelude hiding (Doc)
import Options.Applicative
import System.Environment
import System.Process qualified as P
minijuvixBuildDir :: FilePath
minijuvixBuildDir = ".minijuvix-build"
juvixBuildDir :: FilePath
juvixBuildDir = ".juvix-build"
data CompileTarget = TargetC | TargetWasm
deriving stock (Show)
@ -85,14 +85,14 @@ parseCompile = do
inputCFile :: FilePath -> FilePath -> FilePath
inputCFile projRoot compileInputFile =
projRoot </> minijuvixBuildDir </> outputMiniCFile
projRoot </> juvixBuildDir </> outputMiniCFile
where
outputMiniCFile :: FilePath
outputMiniCFile = takeBaseName compileInputFile <> ".c"
runCompile :: FilePath -> FilePath -> CompileOptions -> Text -> IO (Either Text ())
runCompile projRoot compileInputFile o minic = do
createDirectoryIfMissing True (projRoot </> minijuvixBuildDir)
createDirectoryIfMissing True (projRoot </> juvixBuildDir)
TIO.writeFile (inputCFile projRoot compileInputFile) minic
prepareRuntime projRoot o
case o ^. compileTarget of
@ -119,7 +119,7 @@ prepareRuntime projRoot o = do
writeRuntime :: (FilePath, BS.ByteString) -> IO ()
writeRuntime (filePath, contents) =
BS.writeFile (projRoot </> minijuvixBuildDir </> takeFileName filePath) contents
BS.writeFile (projRoot </> juvixBuildDir </> takeFileName filePath) contents
clangCompile :: FilePath -> FilePath -> CompileOptions -> IO (Either Text ())
clangCompile projRoot compileInputFile o = do
@ -150,7 +150,7 @@ clangCompile projRoot compileInputFile o = do
standaloneArgs :: FilePath -> FilePath -> FilePath -> FilePath -> [String]
standaloneArgs projRoot sysrootPath wasmOutputFile inputFile =
commonArgs sysrootPath wasmOutputFile
<> [projRoot </> minijuvixBuildDir </> "walloc.c", inputFile]
<> [projRoot </> juvixBuildDir </> "walloc.c", inputFile]
libcArgs :: FilePath -> FilePath -> FilePath -> [String]
libcArgs sysrootPath wasmOutputFile inputFile =
@ -163,7 +163,7 @@ commonArgs sysrootPath wasmOutputFile =
"-std=c99",
"-Oz",
"-I",
minijuvixBuildDir,
juvixBuildDir,
"--target=wasm32-wasi",
"--sysroot",
sysrootPath,

View File

@ -1,6 +1,6 @@
module Commands.Extra where
import MiniJuvix.Prelude hiding (Doc)
import Juvix.Prelude hiding (Doc)
import Options.Applicative
import Options.Applicative.Builder.Internal
import Options.Applicative.Types
@ -9,8 +9,8 @@ parserInputFile :: Parser FilePath
parserInputFile =
argument
str
( metavar "MINIJUVIX_FILE"
<> help "Path to a .mjuvix file"
( metavar "JUVIX_FILE"
<> help "Path to a .juvix file"
<> action "file"
)

View File

@ -1,7 +1,7 @@
module Commands.Html where
import MiniJuvix.Prelude hiding (Doc)
import MiniJuvix.Syntax.Concrete.Scoped.Pretty.Html
import Juvix.Prelude hiding (Doc)
import Juvix.Syntax.Concrete.Scoped.Pretty.Html
import Options.Applicative
data HtmlOptions = HtmlOptions

View File

@ -1,6 +1,6 @@
module Commands.MicroJuvix where
import MiniJuvix.Prelude hiding (Doc)
import Juvix.Prelude hiding (Doc)
import Options.Applicative
data MicroJuvixCommand
@ -36,19 +36,19 @@ parseMicroJuvixCommand =
arityInfo =
info
(pure Arity)
(progDesc "Translate a MiniJuvix file to MicroJuvix and insert holes")
(progDesc "Translate a Juvix file to MicroJuvix and insert holes")
prettyInfo :: ParserInfo MicroJuvixCommand
prettyInfo =
info
(pure Pretty)
(progDesc "Translate a MiniJuvix file to MicroJuvix and pretty print the result")
(progDesc "Translate a Juvix file to MicroJuvix and pretty print the result")
typeCheckInfo :: ParserInfo MicroJuvixCommand
typeCheckInfo =
info
(TypeCheck <$> parseMicroJuvixType)
(progDesc "Translate a MiniJuvix file to MicroJuvix and typecheck the result")
(progDesc "Translate a Juvix file to MicroJuvix and typecheck the result")
parseMicroJuvixType :: Parser MicroJuvixTypeOptions
parseMicroJuvixType = do

View File

@ -2,7 +2,7 @@
module Commands.Parse where
import MiniJuvix.Prelude hiding (Doc)
import Juvix.Prelude hiding (Doc)
import Options.Applicative
newtype ParseOptions = ParseOptions

View File

@ -1,6 +1,6 @@
module Commands.Scope where
import MiniJuvix.Prelude hiding (Doc)
import Juvix.Prelude hiding (Doc)
import Options.Applicative
newtype ScopeOptions = ScopeOptions

View File

@ -3,8 +3,8 @@ module Commands.Termination where
import Control.Monad.Extra
import Data.Text qualified as Text
import GlobalOptions
import MiniJuvix.Prelude hiding (Doc)
import MiniJuvix.Syntax.Abstract.Pretty.Base qualified as A
import Juvix.Prelude hiding (Doc)
import Juvix.Syntax.Abstract.Pretty.Base qualified as A
import Options.Applicative
data TerminationCommand
@ -81,7 +81,7 @@ parseTerminationCommand =
minfo =
info
(Calls <$> parseCalls)
(progDesc "Compute the calls table of a .mjuvix file")
(progDesc "Compute the calls table of a .juvix file")
commandGraph :: Mod CommandFields TerminationCommand
commandGraph = command "graph" minfo
where
@ -89,7 +89,7 @@ parseTerminationCommand =
minfo =
info
(CallGraph <$> parseCallGraph)
(progDesc "Compute the complete call graph of a .mjuvix file")
(progDesc "Compute the complete call graph of a .juvix file")
callsPrettyOptions :: GlobalOptions -> CallsOptions -> A.Options
callsPrettyOptions GlobalOptions {..} CallsOptions {..} =

View File

@ -4,7 +4,7 @@ module GlobalOptions
where
import Commands.Extra
import MiniJuvix.Prelude
import Juvix.Prelude
import Options.Applicative hiding (hidden)
data GlobalOptions = GlobalOptions
@ -64,7 +64,7 @@ parseGlobalFlags b = do
_globalOnlyErrors <-
switch
( long "only-errors"
<> help "Only print errors in a uniform format (used by minijuvix-mode)"
<> help "Only print errors in a uniform format (used by juvix-mode)"
<> hidden b
)
_globalNoTermination <-

View File

@ -6,36 +6,36 @@ import Commands.Termination as Termination
import Control.Exception qualified as IO
import Control.Monad.Extra
import Data.HashMap.Strict qualified as HashMap
import MiniJuvix.Pipeline
import MiniJuvix.Prelude hiding (Doc)
import MiniJuvix.Prelude.Pretty hiding (Doc)
import MiniJuvix.Syntax.Abstract.InfoTable qualified as Abstract
import MiniJuvix.Syntax.Abstract.Language qualified as Abstract
import MiniJuvix.Syntax.Abstract.Pretty qualified as Abstract
import MiniJuvix.Syntax.Concrete.Parser qualified as Parser
import MiniJuvix.Syntax.Concrete.Scoped.Highlight qualified as Highlight
import MiniJuvix.Syntax.Concrete.Scoped.InfoTable qualified as Scoper
import MiniJuvix.Syntax.Concrete.Scoped.Pretty qualified as Scoper
import MiniJuvix.Syntax.Concrete.Scoped.Pretty.Html
import MiniJuvix.Syntax.Concrete.Scoped.Scoper qualified as Scoper
import MiniJuvix.Syntax.MicroJuvix.MicroJuvixArityResult qualified as MicroArity
import MiniJuvix.Syntax.MicroJuvix.Pretty qualified as Micro
import MiniJuvix.Syntax.MicroJuvix.TypeChecker qualified as MicroTyped
import MiniJuvix.Syntax.MiniHaskell.Pretty qualified as MiniHaskell
import MiniJuvix.Syntax.MonoJuvix.Pretty qualified as Mono
import MiniJuvix.Termination qualified as Termination
import MiniJuvix.Translation.AbstractToMicroJuvix qualified as Micro
import MiniJuvix.Translation.MicroJuvixToMonoJuvix qualified as Mono
import MiniJuvix.Translation.MonoJuvixToMiniC qualified as MiniC
import MiniJuvix.Translation.MonoJuvixToMiniHaskell qualified as MiniHaskell
import MiniJuvix.Translation.ScopedToAbstract qualified as Abstract
import MiniJuvix.Utils.Version (runDisplayVersion)
import Juvix.Pipeline
import Juvix.Prelude hiding (Doc)
import Juvix.Prelude.Pretty hiding (Doc)
import Juvix.Syntax.Abstract.InfoTable qualified as Abstract
import Juvix.Syntax.Abstract.Language qualified as Abstract
import Juvix.Syntax.Abstract.Pretty qualified as Abstract
import Juvix.Syntax.Concrete.Parser qualified as Parser
import Juvix.Syntax.Concrete.Scoped.Highlight qualified as Highlight
import Juvix.Syntax.Concrete.Scoped.InfoTable qualified as Scoper
import Juvix.Syntax.Concrete.Scoped.Pretty qualified as Scoper
import Juvix.Syntax.Concrete.Scoped.Pretty.Html
import Juvix.Syntax.Concrete.Scoped.Scoper qualified as Scoper
import Juvix.Syntax.MicroJuvix.MicroJuvixArityResult qualified as MicroArity
import Juvix.Syntax.MicroJuvix.Pretty qualified as Micro
import Juvix.Syntax.MicroJuvix.TypeChecker qualified as MicroTyped
import Juvix.Syntax.MiniHaskell.Pretty qualified as MiniHaskell
import Juvix.Syntax.MonoJuvix.Pretty qualified as Mono
import Juvix.Termination qualified as Termination
import Juvix.Translation.AbstractToMicroJuvix qualified as Micro
import Juvix.Translation.MicroJuvixToMonoJuvix qualified as Mono
import Juvix.Translation.MonoJuvixToMiniC qualified as MiniC
import Juvix.Translation.MonoJuvixToMiniHaskell qualified as MiniHaskell
import Juvix.Translation.ScopedToAbstract qualified as Abstract
import Juvix.Utils.Version (runDisplayVersion)
import Options.Applicative
import System.Environment (getProgName)
import Text.Show.Pretty hiding (Html)
minijuvixYamlFile :: FilePath
minijuvixYamlFile = "minijuvix.yaml"
juvixYamlFile :: FilePath
juvixYamlFile = "juvix.yaml"
findRoot :: CommandGlobalOptions -> IO FilePath
findRoot copts = do
@ -60,7 +60,7 @@ findRoot copts = do
go :: IO FilePath
go = do
c <- getCurrentDirectory
l <- findFile (possiblePaths c) minijuvixYamlFile
l <- findFile (possiblePaths c) juvixYamlFile
case l of
Nothing -> return c
Just yaml -> return (takeDirectory yaml)
@ -89,7 +89,7 @@ runCommand cmdWithOpts = do
_ -> do
-- Other commands require an entry point:
case getEntryPoint root globalOpts of
Nothing -> printFailureExit "Provide a MiniJuvix file to run this command\nUse --help to see all the options"
Nothing -> printFailureExit "Provide a Juvix file to run this command\nUse --help to see all the options"
Just entryPoint -> do
case cmd of
Highlight -> do

View File

@ -1,5 +1,5 @@
[book]
title = "The MiniJuvix Book"
title = "The Juvix Book"
authors = [ "Jonathan Prieto-Cubides" , "Jan Mas Rovira" , "Paul Cadman" ]
language = "en"
multilingual = false

View File

@ -1,6 +1,6 @@
* Summary
- [[./introduction/about/what-is.md][MiniJuvix]]
- [[./introduction/about/what-is.md][Juvix]]
- [[./introduction/changelog.md][Changelog]]
- [[./getting-started/README.md][Getting started]]
- [[./getting-started/quick-start.md][Quick start]]

View File

@ -1,4 +1,4 @@
* Internal MiniJuvix languages
* Internal Juvix languages
** Languages

View File

@ -1,9 +1,9 @@
* Mini C Hello World
In the following example a MiniJuvix file is compiled using the C backend.
In the following example a Juvix file is compiled using the C backend.
#+begin_src
-- tests/positive/MiniC/HelloWorld/Input.mjuvix
-- tests/positive/MiniC/HelloWorld/Input.juvix
module Input;
axiom String : Type;
@ -37,7 +37,7 @@ NB: Set the =WASI_SYSROOT_PATH= environment variable to the root of the WASI sys
#+begin_src shell
cd tests/positive/MiniC/HelloWorld
minijuvix compile Input.mjuvix
juvix compile Input.juvix
wasmer Input.wasm
#+end_src

View File

@ -1,7 +1,7 @@
# Polymorphic simple fungible token
#+begin_src
-- tests/positive/FullExamples/SimpleFungibleTokenImplicit.mjuvix
-- tests/positive/FullExamples/SimpleFungibleTokenImplicit.juvix
module SimpleFungibleTokenImplicit;
foreign ghc {

View File

@ -1,6 +1,6 @@
* Installing dependencies
The following dependencies are required for the minijuvix WASM compiler.
The following dependencies are required for the juvix WASM compiler.
- [[https://wasmer.io][wasmer]]
- [[https://releases.llvm.org/download.html][Clang / LLVM]] version 13 or later (NB: On macOS the preinstalled clang does not support the wasm

View File

@ -1,26 +1,26 @@
* Quick Start
#+begin_html
<a href="https://github.com/heliaxdev/MiniJuvix">
<img align="left" width="200" height="200" alt="MiniJuvix Mascot" src="../assets/teaching-mascot.f828959.svg" />
<a href="https://github.com/anoma/juvix">
<img align="left" width="200" height="200" alt="Juvix Mascot" src="../assets/teaching-mascot.f828959.svg" />
</a>
#+end_html
To install MiniJuvix, you can download its sources using
To install Juvix, you can download its sources using
[[http://git-scm.com/][Git]] from the
[[https://github.com/heliaxdev/minijuvix.git][Github repository]]. Then, the
[[https://github.com/anoma/juvix.git][Github repository]]. Then, the
program can be downloaded and installed with the following commands. You
will need to have [[https://haskellstack.org][Stack]] installed.
#+begin_src shell
git clone --recursive https://github.com/heliaxdev/minijuvix.git
cd minijuvix
git clone --recursive https://github.com/anoma/juvix.git
cd juvix
stack install
#+end_src
If the installation succeeds, you must be able to run the =minijuvix=
If the installation succeeds, you must be able to run the =juvix=
command from any location.
To get the complete list of commands, please run =minijuvix --help=.
To get the complete list of commands, please run =juvix --help=.

View File

@ -1,6 +1,6 @@
* MiniJuvix community
* Juvix community
We would love to hear what you think of MiniJuvix! Join us on
We would love to hear what you think of Juvix! Join us on
[[https://discord.gg/nsGaCZzJ][Discord]]
This project is part of a bigger effort called [[https://anoma.net/][Anoma]].

View File

@ -1 +1 @@
* The MiniJuvix Dev Team
* The Juvix Dev Team

View File

@ -1,39 +1,39 @@
* MiniJuvix
* Juvix
#+begin_html
<a href="https://github.com/heliaxdev/MiniJuvix/actions/workflows/ci.yml">
<img alt="CI status" src="https://github.com/heliaxdev/MiniJuvix/actions/workflows/ci.yml/badge.svg" />
<a href="https://github.com/anoma/juvix/actions/workflows/ci.yml">
<img alt="CI status" src="https://github.com/anoma/juvix/actions/workflows/ci.yml/badge.svg" />
</a>
#+end_html
#+begin_html
<a href="https://github.com/heliaxdev/minijuvix/tags">
<img alt="" src="https://img.shields.io/github/v/release/heliaxdev/minijuvix?include_prereleases" />
<a href="https://github.com/anoma/juvix/tags">
<img alt="" src="https://img.shields.io/github/v/release/anoma/juvix?include_prereleases" />
</a>
#+end_html
#+begin_html
<a href="https://github.com/heliaxdev/minijuvix/blob/main/LICENSE">
<a href="https://github.com/anoma/juvix/blob/main/LICENSE">
<img alt="LICENSE" src="https://img.shields.io/badge/license-GPL--3.0--only-blue.svg" />
</a>
#+end_html
#+begin_html
<a href="https://github.com/heliaxdev/minijuvix/actions/workflows/pages/pages-build-deployment"><img
src="https://github.com/heliaxdev/minijuvix/actions/workflows/pages/pages-build-deployment/badge.svg"
<a href="https://github.com/anoma/juvix/actions/workflows/pages/pages-build-deployment"><img
src="https://github.com/anoma/juvix/actions/workflows/pages/pages-build-deployment/badge.svg"
alt="pages-build-deployment" /></a>
#+end_html
#+begin_html
<a href="https://github.com/heliaxdev/MiniJuvix">
<img align="right" width="300" height="300" alt="MiniJuvix Mascot" src="../assets/seating-mascot.051c86a.svg" />
<a href="https://github.com/anoma/juvix">
<img align="right" width="300" height="300" alt="Juvix Mascot" src="../assets/seating-mascot.051c86a.svg" />
</a>
#+end_html
MiniJuvix is a research programming language created by [[https://heliax.dev/][Heliax]] as a first step toward creating more robust and reliable alternatives for formally verified smart contracts than existing languages. The MiniJuvix language is constantly evolving, open-source, functional, and statically typed with special support for compiling [[https://anoma.network/blog/validity-predicates/][validity predicates]] to the =C= language, which can be deployed to various distributed ledgers including [[https://anoma.net/][Anoma]].
Juvix is a research programming language created by [[https://heliax.dev/][Heliax]] as a first step toward creating more robust and reliable alternatives for formally verified smart contracts than existing languages. The Juvix language is constantly evolving, open-source, functional, and statically typed with special support for compiling [[https://anoma.network/blog/validity-predicates/][validity predicates]] to the =C= language, which can be deployed to various distributed ledgers including [[https://anoma.net/][Anoma]].
The MiniJuvix programming language allows developers to write programs with a high degree of assurance that they will meet specific standards. This is due to the fact that several static analyses are performed during compilation, including, for example, scope, termination, arity, and type checking. As a result, functional programs, especially validity predicates, can be written with greater confidence that they will be free of runtime errors. [[https://github.com/heliaxdev/minijuvix/tree/main/examples/milestone][Here are some examples of MiniJuvix programs]].
The Juvix programming language allows developers to write programs with a high degree of assurance that they will meet specific standards. This is due to the fact that several static analyses are performed during compilation, including, for example, scope, termination, arity, and type checking. As a result, functional programs, especially validity predicates, can be written with greater confidence that they will be free of runtime errors. [[https://github.com/anoma/juvix/tree/main/examples/milestone][Here are some examples of Juvix programs]].
The language features:
@ -45,4 +45,4 @@ The language features:
- [X] holes in programs
- [X] axioms for non-computable terms
Additionally, the foreign and compile blocks syntax enable developers to compile a program to different backends including the =C= language. The MiniJuvix module system further permits splitting programs into several modules to build libraries which can be later documented by generating HTML files based on the codebase, see for example, [[https://heliaxdev.github.io/minijuvix-stdlib/][the Minijuvix standard library's website]]. For futher details, please refer to [[https://heliaxdev.github.io/minijuvix/][the MiniJuvix book]] which icludes our [[https://heliaxdev.github.io/minijuvix/introduction/changelog.html][latest updates]].
Additionally, the foreign and compile blocks syntax enable developers to compile a program to different backends including the =C= language. The Juvix module system further permits splitting programs into several modules to build libraries which can be later documented by generating HTML files based on the codebase, see for example, [[https://anoma.github.io/juvix-stdlib/][the Juvix standard library's website]]. For futher details, please refer to [[https://anoma.github.io/juvix/][the Juvix book]] which icludes our [[https://anoma.github.io/juvix/introduction/changelog.html][latest updates]].

View File

@ -1,373 +1,373 @@
* Changelog
#+begin_html
<a href="https://github.com/heliaxdev/MiniJuvix">
<img align="right" width="300" height="300" alt="MiniJuvix Mascot" src="../assets/Seating_Tara_smiling.svg" />
<a href="https://github.com/anoma/juvix">
<img align="right" width="300" height="300" alt="Juvix Mascot" src="../assets/Seating_Tara_smiling.svg" />
</a>
#+end_html
** [[https://github.com/heliaxdev/minijuvix/tree/v0.2.0][v0.2.0]]
** [[https://github.com/anoma/juvix/tree/v0.2.0][v0.2.0]]
(2022-06-28)
[[https://github.com/heliaxdev/minijuvix/compare/v0.1.4...v0.2.0][Full
[[https://github.com/anoma/juvix/compare/v0.1.4...v0.2.0][Full
Changelog]]
*Implemented enhancements:*
- Support built in types
[[https://github.com/heliaxdev/minijuvix/pull/192][#192]]
[[https://github.com/anoma/juvix/pull/192][#192]]
([[https://github.com/janmasrovira][janmasrovira]])
- Support partial application and closure passing in C backend
[[https://github.com/heliaxdev/minijuvix/pull/190][#190]]
[[https://github.com/anoma/juvix/pull/190][#190]]
([[https://github.com/paulcadman][paulcadman]])
- Allow =open import= statements
[[https://github.com/heliaxdev/minijuvix/pull/175][#175]]
[[https://github.com/anoma/juvix/pull/175][#175]]
([[https://github.com/janmasrovira][janmasrovira]])
- Remove TypeAny and adapt typechecking for literals
[[https://github.com/heliaxdev/minijuvix/pull/173][#173]]
[[https://github.com/anoma/juvix/pull/173][#173]]
([[https://github.com/janmasrovira][janmasrovira]])
- Allow holes to be refined into function types
[[https://github.com/heliaxdev/minijuvix/pull/165][#165]]
[[https://github.com/anoma/juvix/pull/165][#165]]
([[https://github.com/janmasrovira][janmasrovira]])
- Support implicit arguments
[[https://github.com/heliaxdev/minijuvix/pull/144][#144]]
[[https://github.com/anoma/juvix/pull/144][#144]]
([[https://github.com/janmasrovira][janmasrovira]])
- Add support for holes in type signatures
[[https://github.com/heliaxdev/minijuvix/pull/141][#141]]
[[https://github.com/anoma/juvix/pull/141][#141]]
([[https://github.com/janmasrovira][janmasrovira]])
- Support function closures with no environment in minic
[[https://github.com/heliaxdev/minijuvix/pull/137][#137]]
[[https://github.com/anoma/juvix/pull/137][#137]]
([[https://github.com/paulcadman][paulcadman]])
- Add holes for expressions in function clauses and inference support
[[https://github.com/heliaxdev/minijuvix/pull/136][#136]]
[[https://github.com/anoma/juvix/pull/136][#136]]
([[https://github.com/janmasrovira][janmasrovira]])
- Add "-Oz" optimization flag to clang args
[[https://github.com/heliaxdev/minijuvix/pull/133][#133]]
[[https://github.com/anoma/juvix/pull/133][#133]]
([[https://github.com/paulcadman][paulcadman]])
- Add version and help option and root command to the CLI
[[https://github.com/heliaxdev/minijuvix/pull/131][#131]]
[[https://github.com/anoma/juvix/pull/131][#131]]
([[https://github.com/jonaprieto][jonaprieto]])
*Fixed bugs:*
- Fix: Ignore implicit patterns and arguments in termination checking
[[https://github.com/heliaxdev/minijuvix/pull/172][#172]]
[[https://github.com/anoma/juvix/pull/172][#172]]
([[https://github.com/janmasrovira][janmasrovira]])
- Fix: pretty printing for terminating keyword
[[https://github.com/heliaxdev/minijuvix/pull/145][#145]]
[[https://github.com/anoma/juvix/pull/145][#145]]
([[https://github.com/jonaprieto][jonaprieto]])
*Merged pull requests:*
- Fix: proper error handling for typechecker errors
[[https://github.com/heliaxdev/minijuvix/pull/189][#189]]
[[https://github.com/anoma/juvix/pull/189][#189]]
([[https://github.com/jonaprieto][jonaprieto]])
- Add minijuvix version info and date to HTML output
[[https://github.com/heliaxdev/minijuvix/pull/186][#186]]
- Add juvix version info and date to HTML output
[[https://github.com/anoma/juvix/pull/186][#186]]
([[https://github.com/jonaprieto][jonaprieto]])
- Fix: Add check for constructor return types
[[https://github.com/heliaxdev/minijuvix/pull/182][#182]]
[[https://github.com/anoma/juvix/pull/182][#182]]
([[https://github.com/jonaprieto][jonaprieto]])
- Use Abstract name in Abstract syntax and Micro/MonoJuvix
[[https://github.com/heliaxdev/minijuvix/pull/181][#181]]
[[https://github.com/anoma/juvix/pull/181][#181]]
([[https://github.com/janmasrovira][janmasrovira]])
- Add an option to specify the path where to put the HTML output
[[https://github.com/heliaxdev/minijuvix/pull/179][#179]]
[[https://github.com/anoma/juvix/pull/179][#179]]
([[https://github.com/jonaprieto][jonaprieto]])
- Upgrade to ghc-9.2.3
[[https://github.com/heliaxdev/minijuvix/pull/178][#178]]
[[https://github.com/anoma/juvix/pull/178][#178]]
([[https://github.com/janmasrovira][janmasrovira]])
- Replace dead link in README with a link to the MiniJuvix book
[[https://github.com/heliaxdev/minijuvix/pull/177][#177]]
- Replace dead link in README with a link to the Juvix book
[[https://github.com/anoma/juvix/pull/177][#177]]
([[https://github.com/paulcadman][paulcadman]])
- Embed HTML assets in the minijuvix binary
[[https://github.com/heliaxdev/minijuvix/pull/176][#176]]
- Embed HTML assets in the juvix binary
[[https://github.com/anoma/juvix/pull/176][#176]]
([[https://github.com/paulcadman][paulcadman]])
- Fix: identifiers with a keyword prefix cannot be parsed
[[https://github.com/heliaxdev/minijuvix/pull/171][#171]]
[[https://github.com/anoma/juvix/pull/171][#171]]
([[https://github.com/janmasrovira][janmasrovira]])
- Improve filepath equality
[[https://github.com/heliaxdev/minijuvix/pull/170][#170]]
[[https://github.com/anoma/juvix/pull/170][#170]]
([[https://github.com/janmasrovira][janmasrovira]])
- Update validity predicate milestone example to 0.2 syntax
[[https://github.com/heliaxdev/minijuvix/pull/167][#167]]
[[https://github.com/anoma/juvix/pull/167][#167]]
([[https://github.com/paulcadman][paulcadman]])
- Fix links in documentation and update to new syntax
[[https://github.com/heliaxdev/minijuvix/pull/163][#163]]
[[https://github.com/anoma/juvix/pull/163][#163]]
([[https://github.com/paulcadman][paulcadman]])
- Update stdlib to work with version 0.2
[[https://github.com/heliaxdev/minijuvix/pull/160][#160]]
[[https://github.com/anoma/juvix/pull/160][#160]]
([[https://github.com/janmasrovira][janmasrovira]])
- Update README usage example to use the compile command
[[https://github.com/heliaxdev/minijuvix/pull/158][#158]]
[[https://github.com/anoma/juvix/pull/158][#158]]
([[https://github.com/paulcadman][paulcadman]])
- Remove dead code related to the pipeline
[[https://github.com/heliaxdev/minijuvix/pull/156][#156]]
[[https://github.com/anoma/juvix/pull/156][#156]]
([[https://github.com/janmasrovira][janmasrovira]])
- Add negative test for AppLeftImplicit
[[https://github.com/heliaxdev/minijuvix/pull/154][#154]]
[[https://github.com/anoma/juvix/pull/154][#154]]
([[https://github.com/janmasrovira][janmasrovira]])
- Add positive test designed for implicit arguments
[[https://github.com/heliaxdev/minijuvix/pull/153][#153]]
[[https://github.com/anoma/juvix/pull/153][#153]]
([[https://github.com/janmasrovira][janmasrovira]])
- Remove ExpressionTyped from MicroJuvix
[[https://github.com/heliaxdev/minijuvix/pull/143][#143]]
[[https://github.com/anoma/juvix/pull/143][#143]]
([[https://github.com/janmasrovira][janmasrovira]])
- Revision for package.yaml and minor deletions
[[https://github.com/heliaxdev/minijuvix/pull/135][#135]]
[[https://github.com/anoma/juvix/pull/135][#135]]
([[https://github.com/jonaprieto][jonaprieto]])
** [[https://github.com/heliaxdev/minijuvix/tree/v0.1.4][v0.1.4]]
** [[https://github.com/anoma/juvix/tree/v0.1.4][v0.1.4]]
(2022-05-30)
[[https://github.com/heliaxdev/minijuvix/compare/v0.1.3...v0.1.4][Full
[[https://github.com/anoma/juvix/compare/v0.1.3...v0.1.4][Full
Changelog]]
*Merged pull requests:*
- Generic Errors and refactoring
[[https://github.com/heliaxdev/minijuvix/pull/123][#123]]
[[https://github.com/anoma/juvix/pull/123][#123]]
([[https://github.com/jonaprieto][jonaprieto]])
- Only generates docs if the pull request merges
[[https://github.com/heliaxdev/minijuvix/pull/121][#121]]
[[https://github.com/anoma/juvix/pull/121][#121]]
([[https://github.com/jonaprieto][jonaprieto]])
- Add initial docs generation website
[[https://github.com/heliaxdev/minijuvix/pull/119][#119]]
[[https://github.com/anoma/juvix/pull/119][#119]]
([[https://github.com/jonaprieto][jonaprieto]])
- Fix internal link in README
[[https://github.com/heliaxdev/minijuvix/pull/116][#116]]
[[https://github.com/anoma/juvix/pull/116][#116]]
([[https://github.com/paulcadman][paulcadman]])
- Add minic-runtime for linking without libc
[[https://github.com/heliaxdev/minijuvix/pull/113][#113]]
[[https://github.com/anoma/juvix/pull/113][#113]]
([[https://github.com/paulcadman][paulcadman]])
- Add termination checking to the pipeline
[[https://github.com/heliaxdev/minijuvix/pull/111][#111]]
[[https://github.com/anoma/juvix/pull/111][#111]]
([[https://github.com/jonaprieto][jonaprieto]])
- Support uncurried higher order functions
[[https://github.com/heliaxdev/minijuvix/pull/110][#110]]
[[https://github.com/anoma/juvix/pull/110][#110]]
([[https://github.com/paulcadman][paulcadman]])
- Improve error generation and handling
[[https://github.com/heliaxdev/minijuvix/pull/108][#108]]
[[https://github.com/anoma/juvix/pull/108][#108]]
([[https://github.com/janmasrovira][janmasrovira]])
- Add MiniC tests with clang+wasi-sdk
[[https://github.com/heliaxdev/minijuvix/pull/105][#105]]
[[https://github.com/anoma/juvix/pull/105][#105]]
([[https://github.com/paulcadman][paulcadman]])
- Add usage example and move developer docs
[[https://github.com/heliaxdev/minijuvix/pull/96][#96]]
[[https://github.com/anoma/juvix/pull/96][#96]]
([[https://github.com/paulcadman][paulcadman]])
- Refactor warning related stuff
[[https://github.com/heliaxdev/minijuvix/pull/91][#91]]
[[https://github.com/anoma/juvix/pull/91][#91]]
([[https://github.com/janmasrovira][janmasrovira]])
- Remove Agda backend
[[https://github.com/heliaxdev/minijuvix/pull/86][#86]]
[[https://github.com/anoma/juvix/pull/86][#86]]
([[https://github.com/paulcadman][paulcadman]])
*Implemented enhancements:*
- Add =compile= subcommand to generate binaries
[[https://github.com/heliaxdev/minijuvix/issues/128][#128]]
[[https://github.com/anoma/juvix/issues/128][#128]]
- Add intervals to flycheck errors
[[https://github.com/heliaxdev/minijuvix/issues/124][#124]]
- Improve error handling in minijuvix-mode
[[https://github.com/heliaxdev/minijuvix/issues/107][#107]]
[[https://github.com/anoma/juvix/issues/124][#124]]
- Improve error handling in juvix-mode
[[https://github.com/anoma/juvix/issues/107][#107]]
- Support multiple modules in compilation
[[https://github.com/heliaxdev/minijuvix/issues/93][#93]]
[[https://github.com/anoma/juvix/issues/93][#93]]
- Add compile command to CLI
[[https://github.com/heliaxdev/minijuvix/pull/130][#130]]
[[https://github.com/anoma/juvix/pull/130][#130]]
([[https://github.com/paulcadman][paulcadman]])
- Use Interval in GenericErrors
[[https://github.com/heliaxdev/minijuvix/pull/125][#125]]
[[https://github.com/anoma/juvix/pull/125][#125]]
([[https://github.com/janmasrovira][janmasrovira]])
- Remove dev in the CI and other tweaks
[[https://github.com/heliaxdev/minijuvix/pull/118][#118]]
[[https://github.com/anoma/juvix/pull/118][#118]]
([[https://github.com/jonaprieto][jonaprieto]])
- Highlight comments correctly
[[https://github.com/heliaxdev/minijuvix/pull/106][#106]]
[[https://github.com/anoma/juvix/pull/106][#106]]
([[https://github.com/janmasrovira][janmasrovira]])
- Support multiple modules in compilation
[[https://github.com/heliaxdev/minijuvix/pull/100][#100]]
[[https://github.com/anoma/juvix/pull/100][#100]]
([[https://github.com/janmasrovira][janmasrovira]])
- New target syntax and modular VP examples
[[https://github.com/heliaxdev/minijuvix/pull/92][#92]]
[[https://github.com/anoma/juvix/pull/92][#92]]
([[https://github.com/jonaprieto][jonaprieto]])
*Fixed bugs:*
- Missing error messages when using throw/error
[[https://github.com/heliaxdev/minijuvix/issues/117][#117]]
[[https://github.com/anoma/juvix/issues/117][#117]]
- Fix highlight of comments
[[https://github.com/heliaxdev/minijuvix/issues/104][#104]]
- Fix minijuvix-mode coloring for projects with multiple modules
[[https://github.com/heliaxdev/minijuvix/issues/101][#101]]
[[https://github.com/anoma/juvix/issues/104][#104]]
- Fix juvix-mode coloring for projects with multiple modules
[[https://github.com/anoma/juvix/issues/101][#101]]
- Fix =highlight= command for modules with import statements
[[https://github.com/heliaxdev/minijuvix/pull/102][#102]]
[[https://github.com/anoma/juvix/pull/102][#102]]
([[https://github.com/janmasrovira][janmasrovira]])
*Closed issues:*
- Deprecate the class JuvixError
[[https://github.com/heliaxdev/minijuvix/issues/115][#115]]
[[https://github.com/anoma/juvix/issues/115][#115]]
- Add ToGenericError instance for the infix parsing errors
[[https://github.com/heliaxdev/minijuvix/issues/114][#114]]
[[https://github.com/anoma/juvix/issues/114][#114]]
- Compile to WASM without linking libc
[[https://github.com/heliaxdev/minijuvix/issues/112][#112]]
[[https://github.com/anoma/juvix/issues/112][#112]]
- Add the termination checker to the pipeline
[[https://github.com/heliaxdev/minijuvix/issues/109][#109]]
[[https://github.com/anoma/juvix/issues/109][#109]]
- Use clang + wasi-sdk instead of emcc to compile to WASM
[[https://github.com/heliaxdev/minijuvix/issues/103][#103]]
[[https://github.com/anoma/juvix/issues/103][#103]]
- Move developer tooling docs out of README
[[https://github.com/heliaxdev/minijuvix/issues/95][#95]]
[[https://github.com/anoma/juvix/issues/95][#95]]
- Add pre-commit checks to CI checks
[[https://github.com/heliaxdev/minijuvix/issues/94][#94]]
[[https://github.com/anoma/juvix/issues/94][#94]]
- Support higher order functions in C backend
[[https://github.com/heliaxdev/minijuvix/issues/90][#90]]
[[https://github.com/anoma/juvix/issues/90][#90]]
- Remove dev from the list of branches in the CI
[[https://github.com/heliaxdev/minijuvix/issues/89][#89]]
[[https://github.com/anoma/juvix/issues/89][#89]]
- Refactor warning related stuff
[[https://github.com/heliaxdev/minijuvix/issues/87][#87]]
- The MiniJuvix website
[[https://github.com/heliaxdev/minijuvix/issues/51][#51]]
[[https://github.com/anoma/juvix/issues/87][#87]]
- The Juvix website
[[https://github.com/anoma/juvix/issues/51][#51]]
** [[https://github.com/heliaxdev/minijuvix/tree/v0.1.3][v0.1.3]]
** [[https://github.com/anoma/juvix/tree/v0.1.3][v0.1.3]]
(2022-05-05)
[[https://github.com/heliaxdev/minijuvix/compare/v0.1.2...v0.1.3][Full
[[https://github.com/anoma/juvix/compare/v0.1.2...v0.1.3][Full
Changelog]]
*Closed issues:*
- Monomorphisation naming inconsistency
[[https://github.com/heliaxdev/minijuvix/issues/84][#84]]
[[https://github.com/anoma/juvix/issues/84][#84]]
- Remove BackendAgda
[[https://github.com/heliaxdev/minijuvix/issues/83][#83]]
[[https://github.com/anoma/juvix/issues/83][#83]]
- Change terminating keyword behavior
[[https://github.com/heliaxdev/minijuvix/issues/81][#81]]
[[https://github.com/anoma/juvix/issues/81][#81]]
- MonoJuvix =ExpressionTyped= is never used
[[https://github.com/heliaxdev/minijuvix/issues/79][#79]]
[[https://github.com/anoma/juvix/issues/79][#79]]
- Bump stackage nightly and delete =allow-newer: true= from =stack.yaml=
[[https://github.com/heliaxdev/minijuvix/issues/75][#75]]
[[https://github.com/anoma/juvix/issues/75][#75]]
- Generate automatically CHANGELOG and Github Release Notes
[[https://github.com/heliaxdev/minijuvix/issues/73][#73]]
[[https://github.com/anoma/juvix/issues/73][#73]]
- Make flag --show-name-ids global
[[https://github.com/heliaxdev/minijuvix/issues/61][#61]]
[[https://github.com/anoma/juvix/issues/61][#61]]
- Add C code generation backend
[[https://github.com/heliaxdev/minijuvix/issues/60][#60]]
[[https://github.com/anoma/juvix/issues/60][#60]]
- Add polymorphism
[[https://github.com/heliaxdev/minijuvix/issues/59][#59]]
[[https://github.com/anoma/juvix/issues/59][#59]]
- Add the compile keyword to the frontend syntax (support up to Scoping)
[[https://github.com/heliaxdev/minijuvix/issues/58][#58]]
[[https://github.com/anoma/juvix/issues/58][#58]]
- Error with undefined or underscores
[[https://github.com/heliaxdev/minijuvix/issues/54][#54]]
[[https://github.com/anoma/juvix/issues/54][#54]]
- Add support for other GHC and Stack stable version
[[https://github.com/heliaxdev/minijuvix/issues/52][#52]]
[[https://github.com/anoma/juvix/issues/52][#52]]
- Autodetect output ANSI support when prettyprinting
[[https://github.com/heliaxdev/minijuvix/issues/38][#38]]
[[https://github.com/anoma/juvix/issues/38][#38]]
- Terminating for type signatures
[[https://github.com/heliaxdev/minijuvix/issues/11][#11]]
[[https://github.com/anoma/juvix/issues/11][#11]]
*Merged pull requests:*
- Remove agda backend
[[https://github.com/heliaxdev/minijuvix/pull/86][#86]]
[[https://github.com/anoma/juvix/pull/86][#86]]
([[https://github.com/paulcadman][paulcadman]])
- 84 monomorphisation naming inconsistency
[[https://github.com/heliaxdev/minijuvix/pull/85][#85]]
[[https://github.com/anoma/juvix/pull/85][#85]]
([[https://github.com/janmasrovira][janmasrovira]])
- Change terminating keyword behavior
[[https://github.com/heliaxdev/minijuvix/pull/82][#82]]
[[https://github.com/anoma/juvix/pull/82][#82]]
([[https://github.com/jonaprieto][jonaprieto]])
- Remove unused constructor ExpressionTyped in Monojuvix
[[https://github.com/heliaxdev/minijuvix/pull/80][#80]]
[[https://github.com/anoma/juvix/pull/80][#80]]
([[https://github.com/janmasrovira][janmasrovira]])
- Stricter stack builds and pedantic mode for CI
[[https://github.com/heliaxdev/minijuvix/pull/78][#78]]
[[https://github.com/anoma/juvix/pull/78][#78]]
([[https://github.com/jonaprieto][jonaprieto]])
- Bump stackage version and remove allow-newer
[[https://github.com/heliaxdev/minijuvix/pull/76][#76]]
[[https://github.com/anoma/juvix/pull/76][#76]]
([[https://github.com/janmasrovira][janmasrovira]])
- Add automatically updates/issues/merged PRs to the changelog
[[https://github.com/heliaxdev/minijuvix/pull/74][#74]]
[[https://github.com/anoma/juvix/pull/74][#74]]
([[https://github.com/jonaprieto][jonaprieto]])
- Add terminating keyword
[[https://github.com/heliaxdev/minijuvix/pull/71][#71]]
[[https://github.com/anoma/juvix/pull/71][#71]]
([[https://github.com/jonaprieto][jonaprieto]])
- Monomorphization
[[https://github.com/heliaxdev/minijuvix/pull/70][#70]]
[[https://github.com/anoma/juvix/pull/70][#70]]
([[https://github.com/janmasrovira][janmasrovira]])
- Remove StatementCompile in AST after scoping
[[https://github.com/heliaxdev/minijuvix/pull/69][#69]]
[[https://github.com/anoma/juvix/pull/69][#69]]
([[https://github.com/paulcadman][paulcadman]])
- Add C code generation backend
[[https://github.com/heliaxdev/minijuvix/pull/68][#68]]
[[https://github.com/anoma/juvix/pull/68][#68]]
([[https://github.com/paulcadman][paulcadman]])
- Check if stderr supports ANSI and print accordingly
[[https://github.com/heliaxdev/minijuvix/pull/67][#67]]
[[https://github.com/anoma/juvix/pull/67][#67]]
([[https://github.com/janmasrovira][janmasrovira]])
- Add support for compile (by Jonathan)
[[https://github.com/heliaxdev/minijuvix/pull/66][#66]]
[[https://github.com/anoma/juvix/pull/66][#66]]
([[https://github.com/paulcadman][paulcadman]])
- Add NameIdGen effect to the pipeline
[[https://github.com/heliaxdev/minijuvix/pull/64][#64]]
[[https://github.com/anoma/juvix/pull/64][#64]]
([[https://github.com/janmasrovira][janmasrovira]])
- Make the =--show-name-ids= flag global
[[https://github.com/heliaxdev/minijuvix/pull/63][#63]]
[[https://github.com/anoma/juvix/pull/63][#63]]
([[https://github.com/janmasrovira][janmasrovira]])
- Implement type checker with polymorphism
[[https://github.com/heliaxdev/minijuvix/pull/62][#62]]
[[https://github.com/anoma/juvix/pull/62][#62]]
([[https://github.com/janmasrovira][janmasrovira]])
** [[https://github.com/heliaxdev/minijuvix/tree/v0.1.2][v0.1.2]]
** [[https://github.com/anoma/juvix/tree/v0.1.2][v0.1.2]]
(2022-04-11)
[[https://github.com/heliaxdev/minijuvix/compare/v0.1.1...v0.1.2][Full
[[https://github.com/anoma/juvix/compare/v0.1.1...v0.1.2][Full
Changelog]]
*Closed issues:*
- Add en emacs mode with support for scoped highlighting
[[https://github.com/heliaxdev/minijuvix/issues/25][#25]]
- Add support for project root detection through a minijuvix.yaml file
[[https://github.com/heliaxdev/minijuvix/issues/24][#24]]
- Add CLI cmd to generate minijuvix autocompletion files for fish and
zsh [[https://github.com/heliaxdev/minijuvix/issues/23][#23]]
[[https://github.com/anoma/juvix/issues/25][#25]]
- Add support for project root detection through a juvix.yaml file
[[https://github.com/anoma/juvix/issues/24][#24]]
- Add CLI cmd to generate juvix autocompletion files for fish and
zsh [[https://github.com/anoma/juvix/issues/23][#23]]
- Add pretty and typecheck subcommands to the microjuvix CLI
[[https://github.com/heliaxdev/minijuvix/issues/21][#21]]
[[https://github.com/anoma/juvix/issues/21][#21]]
- Translate identifiers from MicroJuvix to MiniHaskell (valid Haskell)
[[https://github.com/heliaxdev/minijuvix/issues/19][#19]]
[[https://github.com/anoma/juvix/issues/19][#19]]
- Implement the MiniHaskell to Haskell translation (prettyprinter)
[[https://github.com/heliaxdev/minijuvix/issues/18][#18]]
[[https://github.com/anoma/juvix/issues/18][#18]]
- Implementation of a typechecker for MicroJuvix
[[https://github.com/heliaxdev/minijuvix/issues/16][#16]]
[[https://github.com/anoma/juvix/issues/16][#16]]
- Add references to the Abstract AST to update compilation to
MiniHaskell [[https://github.com/heliaxdev/minijuvix/issues/12][#12]]
MiniHaskell [[https://github.com/anoma/juvix/issues/12][#12]]
- Order in the house
[[https://github.com/heliaxdev/minijuvix/issues/10][#10]]
[[https://github.com/anoma/juvix/issues/10][#10]]
*Merged pull requests:*
- The MiniJuvix project now follows the same goals as the original Juvix
project. [[https://github.com/heliaxdev/minijuvix/pull/7][#7]]
- The Juvix project now follows the same goals as the original Juvix
project. [[https://github.com/anoma/juvix/pull/7][#7]]
([[https://github.com/jonaprieto][jonaprieto]])
- Dev→main [[https://github.com/heliaxdev/minijuvix/pull/6][#6]]
- Dev→main [[https://github.com/anoma/juvix/pull/6][#6]]
([[https://github.com/jonaprieto][jonaprieto]])
- Big update including termination checking
[[https://github.com/heliaxdev/minijuvix/pull/5][#5]]
[[https://github.com/anoma/juvix/pull/5][#5]]
([[https://github.com/janmasrovira][janmasrovira]])
- Parser and scoper
[[https://github.com/heliaxdev/minijuvix/pull/3][#3]]
[[https://github.com/anoma/juvix/pull/3][#3]]
([[https://github.com/jonaprieto][jonaprieto]])
- Upgrade to ghc9 and use hpack
[[https://github.com/heliaxdev/minijuvix/pull/2][#2]]
[[https://github.com/anoma/juvix/pull/2][#2]]
([[https://github.com/janmasrovira][janmasrovira]])
- Merge [[https://github.com/heliaxdev/minijuvix/pull/1][#1]]
- Merge [[https://github.com/anoma/juvix/pull/1][#1]]
([[https://github.com/jonaprieto][jonaprieto]])
** [[https://github.com/heliaxdev/minijuvix/tree/v0.1.1][v0.1.1]]
** [[https://github.com/anoma/juvix/tree/v0.1.1][v0.1.1]]
(2022-03-25)
[[https://github.com/heliaxdev/minijuvix/compare/48abde93b4e5380acabac810e584f4b7a6618592...v0.1.1][Full
[[https://github.com/anoma/juvix/compare/48abde93b4e5380acabac810e584f4b7a6618592...v0.1.1][Full
Changelog]]
- Add support in the parser/scoper for Axiom backends
@ -382,6 +382,6 @@ Changelog]]
*Closed issues:*
- Add diff output to the test suite
[[https://github.com/heliaxdev/minijuvix/issues/9][#9]]
[[https://github.com/anoma/juvix/issues/9][#9]]
- Improve scoper ambiguity error messages
[[https://github.com/heliaxdev/minijuvix/issues/8][#8]]
[[https://github.com/anoma/juvix/issues/8][#8]]

View File

@ -6,7 +6,7 @@ $A$ is a type and there exist a term $x$ that inhabits $A$. Then the program wou
like like the following.
#+begin_src
-- Example.mjuvix
-- Example.juvix
module Example;
axiom A : Type;
axom x : A;

View File

@ -1,6 +1,6 @@
* Function declaration
In MiniJuvix, a function declaration is a type signature /and/ a group
In Juvix, a function declaration is a type signature /and/ a group
of definitions called /function clauses/.
#+begin_example

View File

@ -1,12 +1,12 @@
* Termination checking
To not bring inconsistencies by function declarations, MiniJuvix
To not bring inconsistencies by function declarations, Juvix
requires that all function pass the termination checker.
This check is called before the typechecking in the compilation pipeline.
Since the former requirement is vital but often tricky to fulfill for programs
in a total language like MiniJuvix. It is convenient to have
in a total language like Juvix. It is convenient to have
a way to bypass the termination checking. The user may be certain their
programs are terminating even when our termination checker algorithm can not
see it. The termination checker is limited as it only accepts a subset

View File

@ -38,7 +38,7 @@ The idea is that builtin definitions are treated normally throughout the
pipeline except in the backend part. There is one exception to that. We need to
collect information about the builtins that have been included in the code and
what are the terms that refer to them. For instance, imagine that we find this
definitions in a minijuvix module:
definitions in a juvix module:
#+begin_src text
builtin natural
inductive MyNat {

View File

@ -6,7 +6,7 @@
monomorphic code (no type variables) through static analysis.
Example:
#+begin_src minijuvix
#+begin_src juvix
id : (A : Type) → A → A;
id _ a ≔ a;
@ -18,7 +18,7 @@
#+end_src
Is translated into:
#+begin_src minijuvix
#+begin_src juvix
id_Bool : Bool → Bool;
id_Bool a ≔ a;
@ -28,7 +28,7 @@
* More examples
** Mutual recursion
#+begin_src minijuvix
#+begin_src juvix
inductive List (A : Type) {
nil : List A;
cons : A → List A → List A;
@ -63,7 +63,7 @@ odd A (cons _ xs) ≔ not (even A xs) ;
2. *Sub application*. If =t₁ t₂ … tₙ= is an application then for every =0<i<n=
=t₁ t₂ … tᵢ= is a sub application.
Fix a minijuvix program =P=. Let =𝒲= be the set of all applications that appear in =P=.
Fix a juvix program =P=. Let =𝒲= be the set of all applications that appear in =P=.
1. *Maximal application*. A maximal application is an application =A∈𝒲= such that
for every =A'∈𝒲= we have that =A= is *not* a sub application of =A'=.

View File

@ -3,7 +3,7 @@
** Usage
#+begin_src shell
minijuvix [Global options] ((-v|--version) | --show-root | COMMAND)
juvix [Global options] ((-v|--version) | --show-root | COMMAND)
#+end_src
** Informative options
@ -25,33 +25,33 @@ minijuvix [Global options] ((-v|--version) | --show-root | COMMAND)
printing
- =--only-errors=
Only print errors in a uniform format (used by
minijuvix-mode)
juvix-mode)
** Commands
- =parse=
Parse a MiniJuvix file
Parse a Juvix file
- =scope=
Parse and scope a MiniJuvix file
Parse and scope a Juvix file
- =html=
Generate HTML for a MiniJuvix file
Generate HTML for a Juvix file
- =termination=
Subcommands related to termination checking
- =monojuvix=
Translate a MiniJuvix file to MonoJuvix
Translate a Juvix file to MonoJuvix
- =microjuvix=
Subcommands related to MicroJuvix
- =minihaskell=
Translate a MiniJuvix file to MiniHaskell
Translate a Juvix file to MiniHaskell
- =minic=
Translate a MiniJuvix file to MiniC
Translate a Juvix file to MiniC
- =highlight=
Highlight a MiniJuvix file
Highlight a Juvix file
** CLI Auto-completion Scripts
The MiniJuvix CLI can generate auto-completion scripts. Follow the instructions below for your shell.
The Juvix CLI can generate auto-completion scripts. Follow the instructions below for your shell.
NB: You may need to restart your shell after installing the completion script.
@ -60,7 +60,7 @@ NB: You may need to restart your shell after installing the completion script.
Add the following line to your bash init script (for example =~/.bashrc=).
#+begin_src shell
eval "$(minijuvix --bash-completion-script minijuvix)"
eval "$(juvix --bash-completion-script juvix)"
#+end_src
*** Fish
@ -68,8 +68,8 @@ Add the following line to your bash init script (for example =~/.bashrc=).
Run the following command in your shell:
#+begin_src shell
minijuvix --fish-completion-script minijuvix
> ~/.config/fish/completions/minijuvix.fish
juvix --fish-completion-script juvix
> ~/.config/fish/completions/juvix.fish
#+end_src
*** ZSH
@ -77,7 +77,7 @@ minijuvix --fish-completion-script minijuvix
Run the following command in your shell:
#+begin_src shell
minijuvix --zsh-completion-script minijuvix > $DIR_IN_FPATH/_minijuvix
juvix --zsh-completion-script juvix > $DIR_IN_FPATH/_juvix
#+end_src
where =$DIR_IN_FPATH= is a directory that is present on the [[https://zsh.sourceforge.io/Doc/Release/Functions.html][ZSH FPATH variable]] (which you can inspect by running =echo $FPATH= in the shell).

View File

@ -1,3 +1,3 @@
- [[./tools/CLI.md][Command line Interface]]
- [[./tools/emacs-mode.md][Writting MiniJuvix programs with Emacs Mode]]
- [[./tools/emacs-mode.md][Writting Juvix programs with Emacs Mode]]
- [[./tools/testing.md][Test Suite]]

View File

@ -1,22 +1,22 @@
** Emacs Mode
There is an Emacs mode available for MiniJuvix. Currently, it
There is an Emacs mode available for Juvix. Currently, it
supports syntax highlighting for well-scoped modules.
To install it add the following lines to your Emacs configuration file:
#+begin_src elisp
(push "/path/to/minijuvix/minijuvix-mode/" load-path)
(require 'minijuvix-mode)
(push "/path/to/juvix/juvix-mode/" load-path)
(require 'juvix-mode)
#+end_src
Make sure that =minijuvix= is installed in your =PATH=.
Make sure that =juvix= is installed in your =PATH=.
The MiniJuvix major mode will be activated automatically for =.mjuvix= files.
The Juvix major mode will be activated automatically for =.juvix= files.
*** Keybindings
| Key | Function Name | Description |
|-----------+------------------+-------------------------------------------------------|
| =C-c C-l= | =minijuvix-load= | Runs the scoper and adds semantic syntax highlighting |
| =C-c C-l= | =juvix-load= | Runs the scoper and adds semantic syntax highlighting |

View File

@ -1 +0,0 @@
../Lib/Data

View File

@ -81,9 +81,9 @@ infix 4 >=Nat;
>=Nat l r ≔ (l >Nat r) || (==Nat l r);
foreign c {
void* natInd(int n, void* a1, minijuvix_function_t* a2) {
void* natInd(int n, void* a1, juvix_function_t* a2) {
if (n <= 0) return a1;
return ((void* (*) (minijuvix_function_t*, void*))a2->fun)(a2, natInd(n - 1, a1, a2));
return ((void* (*) (juvix_function_t*, void*))a2->fun)(a2, natInd(n - 1, a1, a2));
\}
};

View File

@ -1 +0,0 @@
../Lib/Prelude.mjuvix

View File

@ -1 +0,0 @@
../Lib/System

View File

@ -1,10 +1,10 @@
cradle:
stack:
- path: "./src"
component: "minijuvix:lib"
component: "juvix:lib"
- path: "./app"
component: "minijuvix:exe:minijuvix"
component: "juvix:exe:juvix"
- path: "./test"
component: "minijuvix:test:minijuvix-test"
component: "juvix:test:juvix-test"

View File

@ -1,16 +1,16 @@
(require 'flycheck)
(require 'minijuvix-customize)
(require 'juvix-customize)
(defgroup flycheck-minijuvix nil
"MiniJuvix support for Flycheck."
:prefix "flycheck-minijuvix-"
(defgroup flycheck-juvix nil
"Juvix support for Flycheck."
:prefix "flycheck-juvix-"
:group 'flycheck
:link '(url-link :tag "Github" "https://github.com/heliaxdev/MiniJuvix"))
:link '(url-link :tag "Github" "https://github.com/anoma/juvix"))
(flycheck-define-checker minijuvix
"A MiniJuvix syntax checker."
:command ("minijuvix" "microjuvix" "typecheck" "--only-errors" "--no-colors"
(option-flag "--no-stdlib" minijuvix-disable-embedded-stdlib)
(flycheck-define-checker juvix
"A Juvix syntax checker."
:command ("juvix" "microjuvix" "typecheck" "--only-errors" "--no-colors"
(option-flag "--no-stdlib" juvix-disable-embedded-stdlib)
source-original)
:error-patterns
(
@ -19,8 +19,8 @@
(error line-start (file-name) ":" line "-" end-line ":" column ": error:" (message (one-or-more (not "ת"))))
(error line-start (file-name) ":" line "-" end-line ":" column "-" end-column ": error:" (message (one-or-more (not "ת"))))
)
:modes minijuvix-mode
:modes juvix-mode
)
(add-to-list 'flycheck-checkers 'minijuvix)
(add-to-list 'flycheck-checkers 'juvix)
(provide 'flycheck-minijuvix)
(provide 'flycheck-juvix)

View File

@ -0,0 +1,12 @@
(defcustom juvix-auto-input-method t
"Automatically set the input method in juvix files."
:type 'boolean
:group 'juvix)
(defcustom juvix-disable-embedded-stdlib nil
"Disable the embedded standard library."
:type 'boolean
:group 'juvix)
(provide 'juvix-customize)

View File

@ -1,78 +1,78 @@
(require 'font-lock)
(defgroup minijuvix-highlight nil
"Syntax highlighting for MiniJuvix."
:group 'minijuvix)
(defgroup juvix-highlight nil
"Syntax highlighting for Juvix."
:group 'juvix)
(defgroup minijuvix-highlight-faces nil
"Faces used to highlight MiniJuvix code."
:group 'minijuvix-highlight)
(defgroup juvix-highlight-faces nil
"Faces used to highlight Juvix code."
:group 'juvix-highlight)
(defface minijuvix-highlight-keyword-face
(defface juvix-highlight-keyword-face
'((((background light))
(:foreground "#399ee6"))
(((background dark))
(:foreground "#81a1c1")))
"The face used for keywords."
:group 'minijuvix-highlight-faces)
:group 'juvix-highlight-faces)
(defface minijuvix-highlight-function-face
(defface juvix-highlight-function-face
'((((background light))
(:foreground "#f2ae49"))
(((background dark))
(:foreground "#ebcb8b")))
"The face used for functions."
:group 'minijuvix-highlight-faces)
:group 'juvix-highlight-faces)
(defface minijuvix-highlight-inductive-face
(defface juvix-highlight-inductive-face
'((((background light))
(:foreground "#86b300"))
(((background dark))
(:foreground "#a3be8c")))
"The face used for inductive types."
:group 'minijuvix-highlight-faces)
:group 'juvix-highlight-faces)
(defface minijuvix-highlight-constructor-face
(defface juvix-highlight-constructor-face
'((((background light))
(:foreground "#a37acc"))
(((background dark))
(:foreground "#b48ead")))
"The face used for constructors."
:group 'minijuvix-highlight-faces)
:group 'juvix-highlight-faces)
(defface minijuvix-highlight-axiom-face
(defface juvix-highlight-axiom-face
'((((background light))
(:foreground "#f07171"))
(((background dark))
(:foreground "#bf616a")))
"The face used for axioms."
:group 'minijuvix-highlight-faces)
:group 'juvix-highlight-faces)
(defface minijuvix-highlight-string-face
(defface juvix-highlight-string-face
'((((background light))
(:foreground "#f07171"))
(((background dark))
(:foreground "#d08770")))
"The face used for string literals."
:group 'minijuvix-highlight-faces)
:group 'juvix-highlight-faces)
(defface minijuvix-highlight-number-face
(defface juvix-highlight-number-face
'((((background light))
(:foreground "#000000"))
(((background dark))
(:foreground "#d8dee9")))
"The face used for numbers."
:group 'minijuvix-highlight-faces)
:group 'juvix-highlight-faces)
(defface minijuvix-highlight-error-face
(defface juvix-highlight-error-face
'((((background light))
(:foreground "#bd3744"))
(((background dark))
(:foreground "#bd3744")))
"The face used for errors."
:group 'minijuvix-highlight-faces)
:group 'juvix-highlight-faces)
(defface minijuvix-highlight-comment-face
(defface juvix-highlight-comment-face
'((((background light))
(:foreground "#8b2252"
:slant italic
@ -83,6 +83,6 @@
)
))
"The face used for comments."
:group 'minijuvix-highlight-faces)
:group 'juvix-highlight-faces)
(provide 'minijuvix-highlight)
(provide 'juvix-highlight)

View File

@ -1,5 +1,5 @@
;;; -*- lexical-binding: t; -*-
;;; minijuvix-input.el --- The minijuvix input method
;;; juvix-input.el --- The juvix input method
;; Copyright (c) 2005-2021 remains with the authors.
;; Agda 2 was originally written by Ulf Norell,
@ -47,15 +47,15 @@
;; A highly customisable input method which can inherit from other
;; Quail input methods. By default the input method is geared towards
;; the input of mathematical and other symbols in MiniJuvix programs.
;; the input of mathematical and other symbols in Juvix programs.
;;
;; Use M-x customize-group minijuvix-input to customise this input method.
;; Use M-x customize-group juvix-input to customise this input method.
;; Note that the functions defined under "Functions used to tweak
;; translation pairs" below can be used to tweak both the key
;; translations inherited from other input methods as well as the
;; ones added specifically for this one.
;;
;; Use minijuvix-input-show-translations to see all the characters which
;; Use juvix-input-show-translations to see all the characters which
;; can be typed using this input method (except for those
;; corresponding to ASCII characters).
@ -74,20 +74,20 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Utility functions
(defun minijuvix-input-concat-map (f xs)
(defun juvix-input-concat-map (f xs)
"Concat (map F XS)."
(apply 'append (mapcar f xs)))
(defun minijuvix-input-to-string-list (s)
(defun juvix-input-to-string-list (s)
"Convert a string S to a list of one-character strings, after
removing all space and newline characters."
(minijuvix-input-concat-map
(juvix-input-concat-map
(lambda (c) (if (member c (string-to-list " \n"))
nil
(list (string c))))
(string-to-list s)))
(defun minijuvix-input-character-range (from to)
(defun juvix-input-character-range (from to)
"A string consisting of the characters from FROM to TO."
(let (seq)
(dotimes (i (1+ (- to from)))
@ -97,29 +97,29 @@ removing all space and newline characters."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Functions used to tweak translation pairs
(defun minijuvix-input-compose (f g)
(defun juvix-input-compose (f g)
"\x -> concatMap F (G x)"
(lambda (x) (minijuvix-input-concat-map f (funcall g x))))
(lambda (x) (juvix-input-concat-map f (funcall g x))))
(defun minijuvix-input-or (f g)
(defun juvix-input-or (f g)
"\x -> F x ++ G x"
(lambda (x) (append (funcall f x) (funcall g x))))
(defun minijuvix-input-nonempty ()
(defun juvix-input-nonempty ()
"Only keep pairs with a non-empty first component."
(lambda (x) (if (> (length (car x)) 0) (list x))))
(defun minijuvix-input-prepend (prefix)
(defun juvix-input-prepend (prefix)
"Prepend PREFIX to all key sequences."
(lambda (x) `((,(concat prefix (car x)) . ,(cdr x)))))
(defun minijuvix-input-prefix (prefix)
(defun juvix-input-prefix (prefix)
"Only keep pairs whose key sequence starts with PREFIX."
(lambda (x)
(if (equal (substring (car x) 0 (length prefix)) prefix)
(list x))))
(defun minijuvix-input-suffix (suffix)
(defun juvix-input-suffix (suffix)
"Only keep pairs whose key sequence ends with SUFFIX."
(lambda (x)
(if (equal (substring (car x)
@ -127,56 +127,56 @@ removing all space and newline characters."
suffix)
(list x))))
(defun minijuvix-input-drop (ss)
(defun juvix-input-drop (ss)
"Drop pairs matching one of the given key sequences.
SS should be a list of strings."
(lambda (x) (unless (member (car x) ss) (list x))))
(defun minijuvix-input-drop-beginning (n)
(defun juvix-input-drop-beginning (n)
"Drop N characters from the beginning of each key sequence."
(lambda (x) `((,(substring (car x) n) . ,(cdr x)))))
(defun minijuvix-input-drop-end (n)
(defun juvix-input-drop-end (n)
"Drop N characters from the end of each key sequence."
(lambda (x)
`((,(substring (car x) 0 (- (length (car x)) n)) .
,(cdr x)))))
(defun minijuvix-input-drop-prefix (prefix)
(defun juvix-input-drop-prefix (prefix)
"Only keep pairs whose key sequence starts with PREFIX.
This prefix is dropped."
(minijuvix-input-compose
(minijuvix-input-drop-beginning (length prefix))
(minijuvix-input-prefix prefix)))
(juvix-input-compose
(juvix-input-drop-beginning (length prefix))
(juvix-input-prefix prefix)))
(defun minijuvix-input-drop-suffix (suffix)
(defun juvix-input-drop-suffix (suffix)
"Only keep pairs whose key sequence ends with SUFFIX.
This suffix is dropped."
(minijuvix-input-compose
(minijuvix-input-drop-end (length suffix))
(minijuvix-input-suffix suffix)))
(juvix-input-compose
(juvix-input-drop-end (length suffix))
(juvix-input-suffix suffix)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Customization
;; The :set keyword is set to 'minijuvix-input-incorporate-changed-setting
;; The :set keyword is set to 'juvix-input-incorporate-changed-setting
;; so that the input method gets updated immediately when users
;; customize it. However, the setup functions cannot be run before all
;; variables have been defined. Hence the :initialize keyword is set to
;; 'custom-initialize-default to ensure that the setup is not performed
;; until minijuvix-input-setup is called at the end of this file.
;; until juvix-input-setup is called at the end of this file.
(defgroup minijuvix-input nil
"The minijuvix input method.
(defgroup juvix-input nil
"The juvix input method.
After tweaking these settings you may want to inspect the resulting
translations using `minijuvix-input-show-translations'."
:group 'minijuvix
translations using `juvix-input-show-translations'."
:group 'juvix
)
(defcustom minijuvix-input-tweak-all
'(minijuvix-input-compose
(minijuvix-input-prepend "\\")
(minijuvix-input-nonempty))
(defcustom juvix-input-tweak-all
'(juvix-input-compose
(juvix-input-prepend "\\")
(juvix-input-nonempty))
"An expression yielding a function which can be used to tweak
all translations before they are included in the input method.
The resulting function (if non-nil) is applied to every
@ -185,52 +185,52 @@ pairs. (Note that the translations can be anything accepted by
`quail-defrule'.)
If you change this setting manually (without using the
customization buffer) you need to call `minijuvix-input-setup' in
customization buffer) you need to call `juvix-input-setup' in
order for the change to take effect."
:group 'minijuvix-input
:set 'minijuvix-input-incorporate-changed-setting
:group 'juvix-input
:set 'juvix-input-incorporate-changed-setting
:initialize 'custom-initialize-default
:type 'sexp)
(defcustom minijuvix-input-inherit
`(("TeX" . (minijuvix-input-compose
(minijuvix-input-drop '("geq" "leq" "bullet" "qed" "par"))
(minijuvix-input-or
(minijuvix-input-drop-prefix "\\")
(minijuvix-input-or
(minijuvix-input-compose
(minijuvix-input-drop '("^l" "^o" "^r" "^v"))
(minijuvix-input-prefix "^"))
(minijuvix-input-prefix "_")))))
(defcustom juvix-input-inherit
`(("TeX" . (juvix-input-compose
(juvix-input-drop '("geq" "leq" "bullet" "qed" "par"))
(juvix-input-or
(juvix-input-drop-prefix "\\")
(juvix-input-or
(juvix-input-compose
(juvix-input-drop '("^l" "^o" "^r" "^v"))
(juvix-input-prefix "^"))
(juvix-input-prefix "_")))))
)
"A list of Quail input methods whose translations should be
inherited by the minijuvix input method (with the exception of
inherited by the juvix input method (with the exception of
translations corresponding to ASCII characters).
The list consists of pairs (qp . tweak), where qp is the name of
a Quail package, and tweak is an expression of the same kind as
`minijuvix-input-tweak-all' which is used to tweak the translation
`juvix-input-tweak-all' which is used to tweak the translation
pairs of the input method.
The inherited translation pairs are added last, after
`minijuvix-input-user-translations' and `minijuvix-input-translations'.
`juvix-input-user-translations' and `juvix-input-translations'.
If you change this setting manually (without using the
customization buffer) you need to call `minijuvix-input-setup' in
customization buffer) you need to call `juvix-input-setup' in
order for the change to take effect."
:group 'minijuvix-input
:set 'minijuvix-input-incorporate-changed-setting
:group 'juvix-input
:set 'juvix-input-incorporate-changed-setting
:initialize 'custom-initialize-default
:type '(repeat (cons (string :tag "Quail package")
(sexp :tag "Tweaking function"))))
(defcustom minijuvix-input-translations
(defcustom juvix-input-translations
(let ((max-lisp-eval-depth 2800)) `(
;; Equality and similar symbols.
("eq" . ,(minijuvix-input-to-string-list "=∼∽≈≋∻∾∿≀≃⋍≂≅ ≌≊≡≣≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≍≎≏≬⋕"))
("eqn" . ,(minijuvix-input-to-string-list "≠≁ ≉ ≄ ≇≆ ≢ ≭ "))
("eq" . ,(juvix-input-to-string-list "=∼∽≈≋∻∾∿≀≃⋍≂≅ ≌≊≡≣≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≍≎≏≬⋕"))
("eqn" . ,(juvix-input-to-string-list "≠≁ ≉ ≄ ≇≆ ≢ ≭ "))
("=n" . (""))
("~" . ("")) ("~n" . (""))
@ -256,10 +256,10 @@ order for the change to take effect."
;; Inequality and similar symbols.
("leq" . ,(minijuvix-input-to-string-list "<≪⋘≤≦≲ ≶≺≼≾⊂⊆ ⋐⊏⊑ ⊰⊲⊴⋖⋚⋜⋞"))
("leqn" . ,(minijuvix-input-to-string-list "≮ ≰≨≴⋦≸⊀ ⋨⊄⊈⊊ ⋢⋤ ⋪⋬ ⋠"))
("geq" . ,(minijuvix-input-to-string-list ">≫⋙≥≧≳ ≷≻≽≿⊃⊇ ⋑⊐⊒ ⊱⊳⊵⋗⋛⋝⋟"))
("geqn" . ,(minijuvix-input-to-string-list "≯ ≱≩≵⋧≹⊁ ⋩⊅⊉⊋ ⋣⋥ ⋫⋭ ⋡"))
("leq" . ,(juvix-input-to-string-list "<≪⋘≤≦≲ ≶≺≼≾⊂⊆ ⋐⊏⊑ ⊰⊲⊴⋖⋚⋜⋞"))
("leqn" . ,(juvix-input-to-string-list "≮ ≰≨≴⋦≸⊀ ⋨⊄⊈⊊ ⋢⋤ ⋪⋬ ⋠"))
("geq" . ,(juvix-input-to-string-list ">≫⋙≥≧≳ ≷≻≽≿⊃⊇ ⋑⊐⊒ ⊱⊳⊵⋗⋛⋝⋟"))
("geqn" . ,(juvix-input-to-string-list "≯ ≱≩≵⋧≹⊁ ⋩⊅⊉⊋ ⋣⋥ ⋫⋭ ⋡"))
("<=" . ("")) (">=" . (""))
("<=n" . ("")) (">=n" . (""))
@ -280,15 +280,15 @@ order for the change to take effect."
;; Set membership etc.
("member" . ,(minijuvix-input-to-string-list "∈∉∊∋∌∍⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿"))
("member" . ,(juvix-input-to-string-list "∈∉∊∋∌∍⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿"))
("inn" . (""))
("nin" . (""))
;; Intersections, unions etc.
("intersection" . ,(minijuvix-input-to-string-list "∩⋂∧⋀⋏⨇⊓⨅⋒∏ ⊼ ⨉"))
("union" . ,(minijuvix-input-to-string-list "∪⋃∨⋁⋎⨈⊔⨆⋓∐⨿⊽⊻⊍⨃⊎⨄⊌∑⅀"))
("intersection" . ,(juvix-input-to-string-list "∩⋂∧⋀⋏⨇⊓⨅⋒∏ ⊼ ⨉"))
("union" . ,(juvix-input-to-string-list "∪⋃∨⋁⋎⨈⊔⨆⋓∐⨿⊽⊻⊍⨃⊎⨄⊌∑⅀"))
("and" . ("")) ("or" . (""))
("And" . ("")) ("Or" . (""))
@ -299,7 +299,7 @@ order for the change to take effect."
;; Entailment etc.
("entails" . ,(minijuvix-input-to-string-list "⊢⊣⊤⊥⊦⊧⊨⊩⊪⊫⊬⊭⊮⊯"))
("entails" . ,(juvix-input-to-string-list "⊢⊣⊤⊥⊦⊧⊨⊩⊪⊫⊬⊭⊮⊯"))
("|-" . ("")) ("|-n" . (""))
("-|" . (""))
@ -323,9 +323,9 @@ order for the change to take effect."
;; Corners, ceilings and floors.
("c" . ,(minijuvix-input-to-string-list "⌜⌝⌞⌟⌈⌉⌊⌋"))
("cu" . ,(minijuvix-input-to-string-list "⌜⌝ ⌈⌉ "))
("cl" . ,(minijuvix-input-to-string-list " ⌞⌟ ⌊⌋"))
("c" . ,(juvix-input-to-string-list "⌜⌝⌞⌟⌈⌉⌊⌋"))
("cu" . ,(juvix-input-to-string-list "⌜⌝ ⌈⌉ "))
("cl" . ,(juvix-input-to-string-list " ⌞⌟ ⌊⌋"))
("cul" . ("")) ("cuL" . (""))
("cur" . ("")) ("cuR" . (""))
@ -342,9 +342,9 @@ order for the change to take effect."
("*" . (""))
(".+" . (""))
(".-" . (""))
(":" . ,(minijuvix-input-to-string-list "∶⦂ː꞉˸፥፦:﹕︓"))
("," . ,(minijuvix-input-to-string-list "ʻ،⸲⸴⹁⹉、︐︑﹐﹑,、"))
(";" . ,(minijuvix-input-to-string-list "؛⁏፤꛶;︔﹔⍮⸵;"))
(":" . ,(juvix-input-to-string-list "∶⦂ː꞉˸፥፦:﹕︓"))
("," . ,(juvix-input-to-string-list "ʻ،⸲⸴⹁⹉、︐︑﹐﹑,、"))
(";" . ,(juvix-input-to-string-list "؛⁏፤꛶;︔﹔⍮⸵;"))
("::" . (""))
("::-" . (""))
("-:" . (""))
@ -383,22 +383,22 @@ order for the change to take effect."
;; Various symbols.
("integral" . ,(minijuvix-input-to-string-list "∫∬∭∮∯∰∱∲∳"))
("angle" . ,(minijuvix-input-to-string-list "∟∡∢⊾⊿"))
("join" . ,(minijuvix-input-to-string-list "⋈⋉⋊⋋⋌⨝⟕⟖⟗"))
("integral" . ,(juvix-input-to-string-list "∫∬∭∮∯∰∱∲∳"))
("angle" . ,(juvix-input-to-string-list "∟∡∢⊾⊿"))
("join" . ,(juvix-input-to-string-list "⋈⋉⋊⋋⋌⨝⟕⟖⟗"))
;; Arrows.
("l" . ,(minijuvix-input-to-string-list "←⇐⇚⇇⇆↤⇦↞↼↽⇠⇺↜⇽⟵⟸↚⇍⇷ ↹ ↢↩↫⇋⇜⇤⟻⟽⤆↶↺⟲ "))
("r" . ,(minijuvix-input-to-string-list "→⇒⇛⇉⇄↦⇨↠⇀⇁⇢⇻↝⇾⟶⟹↛⇏⇸⇶ ↴ ↣↪↬⇌⇝⇥⟼⟾⤇↷↻⟳⇰⇴⟴⟿ ➵➸➙➔➛➜➝➞➟➠➡➢➣➤➧➨➩➪➫➬➭➮➯➱➲➳➺➻➼➽➾⊸"))
("u" . ,(minijuvix-input-to-string-list "↑⇑⟰⇈⇅↥⇧↟↿↾⇡⇞ ↰↱➦ ⇪⇫⇬⇭⇮⇯ "))
("d" . ,(minijuvix-input-to-string-list "↓⇓⟱⇊⇵↧⇩↡⇃⇂⇣⇟ ↵↲↳➥ ↯ "))
("ud" . ,(minijuvix-input-to-string-list "↕⇕ ↨⇳ "))
("lr" . ,(minijuvix-input-to-string-list "↔⇔ ⇼↭⇿⟷⟺↮⇎⇹ "))
("ul" . ,(minijuvix-input-to-string-list "↖⇖ ⇱↸ "))
("ur" . ,(minijuvix-input-to-string-list "↗⇗ ➶➹➚ "))
("dr" . ,(minijuvix-input-to-string-list "↘⇘ ⇲ ➴➷➘ "))
("dl" . ,(minijuvix-input-to-string-list "↙⇙ "))
("l" . ,(juvix-input-to-string-list "←⇐⇚⇇⇆↤⇦↞↼↽⇠⇺↜⇽⟵⟸↚⇍⇷ ↹ ↢↩↫⇋⇜⇤⟻⟽⤆↶↺⟲ "))
("r" . ,(juvix-input-to-string-list "→⇒⇛⇉⇄↦⇨↠⇀⇁⇢⇻↝⇾⟶⟹↛⇏⇸⇶ ↴ ↣↪↬⇌⇝⇥⟼⟾⤇↷↻⟳⇰⇴⟴⟿ ➵➸➙➔➛➜➝➞➟➠➡➢➣➤➧➨➩➪➫➬➭➮➯➱➲➳➺➻➼➽➾⊸"))
("u" . ,(juvix-input-to-string-list "↑⇑⟰⇈⇅↥⇧↟↿↾⇡⇞ ↰↱➦ ⇪⇫⇬⇭⇮⇯ "))
("d" . ,(juvix-input-to-string-list "↓⇓⟱⇊⇵↧⇩↡⇃⇂⇣⇟ ↵↲↳➥ ↯ "))
("ud" . ,(juvix-input-to-string-list "↕⇕ ↨⇳ "))
("lr" . ,(juvix-input-to-string-list "↔⇔ ⇼↭⇿⟷⟺↮⇎⇹ "))
("ul" . ,(juvix-input-to-string-list "↖⇖ ⇱↸ "))
("ur" . ,(juvix-input-to-string-list "↗⇗ ➶➹➚ "))
("dr" . ,(juvix-input-to-string-list "↘⇘ ⇲ ➴➷➘ "))
("dl" . ,(juvix-input-to-string-list "↙⇙ "))
("l-" . ("")) ("<-" . ("")) ("l=" . ("")) ("<=" . (""))
("r-" . ("")) ("->" . ("")) ("r=" . ("")) ("=>" . (""))
@ -439,61 +439,61 @@ order for the change to take effect."
;; Ellipsis.
("..." . ,(minijuvix-input-to-string-list "⋯⋮⋰⋱"))
("..." . ,(juvix-input-to-string-list "⋯⋮⋰⋱"))
;; Box-drawing characters.
("---" . ,(minijuvix-input-to-string-list "─│┌┐└┘├┤┬┼┴╴╵╶╷╭╮╯╰╱╲╳"))
("--=" . ,(minijuvix-input-to-string-list "═║╔╗╚╝╠╣╦╬╩ ╒╕╘╛╞╡╤╪╧ ╓╖╙╜╟╢╥╫╨"))
("--_" . ,(minijuvix-input-to-string-list "━┃┏┓┗┛┣┫┳╋┻╸╹╺╻
("---" . ,(juvix-input-to-string-list "─│┌┐└┘├┤┬┼┴╴╵╶╷╭╮╯╰╱╲╳"))
("--=" . ,(juvix-input-to-string-list "═║╔╗╚╝╠╣╦╬╩ ╒╕╘╛╞╡╤╪╧ ╓╖╙╜╟╢╥╫╨"))
("--_" . ,(juvix-input-to-string-list "━┃┏┓┗┛┣┫┳╋┻╸╹╺╻
"))
("--." . ,(minijuvix-input-to-string-list "╌╎┄┆┈┊
("--." . ,(juvix-input-to-string-list "╌╎┄┆┈┊
"))
;; Triangles.
;; Big/small, black/white.
("t" . ,(minijuvix-input-to-string-list "◂◃◄◅▸▹►▻▴▵▾▿◢◿◣◺◤◸◥◹"))
("T" . ,(minijuvix-input-to-string-list "◀◁▶▷▲△▼▽◬◭◮"))
("t" . ,(juvix-input-to-string-list "◂◃◄◅▸▹►▻▴▵▾▿◢◿◣◺◤◸◥◹"))
("T" . ,(juvix-input-to-string-list "◀◁▶▷▲△▼▽◬◭◮"))
("tb" . ,(minijuvix-input-to-string-list "◂▸▴▾◄►◢◣◤◥"))
("tw" . ,(minijuvix-input-to-string-list "◃▹▵▿◅▻◿◺◸◹"))
("tb" . ,(juvix-input-to-string-list "◂▸▴▾◄►◢◣◤◥"))
("tw" . ,(juvix-input-to-string-list "◃▹▵▿◅▻◿◺◸◹"))
("Tb" . ,(minijuvix-input-to-string-list "◀▶▲▼"))
("Tw" . ,(minijuvix-input-to-string-list "◁▷△▽"))
("Tb" . ,(juvix-input-to-string-list "◀▶▲▼"))
("Tw" . ,(juvix-input-to-string-list "◁▷△▽"))
;; Squares.
("sq" . ,(minijuvix-input-to-string-list "■□◼◻◾◽▣▢▤▥▦▧▨▩◧◨◩◪◫◰◱◲◳"))
("sqb" . ,(minijuvix-input-to-string-list "■◼◾"))
("sqw" . ,(minijuvix-input-to-string-list "□◻◽"))
("sq" . ,(juvix-input-to-string-list "■□◼◻◾◽▣▢▤▥▦▧▨▩◧◨◩◪◫◰◱◲◳"))
("sqb" . ,(juvix-input-to-string-list "■◼◾"))
("sqw" . ,(juvix-input-to-string-list "□◻◽"))
("sq." . (""))
("sqo" . (""))
;; Rectangles.
("re" . ,(minijuvix-input-to-string-list "▬▭▮▯"))
("reb" . ,(minijuvix-input-to-string-list "▬▮"))
("rew" . ,(minijuvix-input-to-string-list "▭▯"))
("re" . ,(juvix-input-to-string-list "▬▭▮▯"))
("reb" . ,(juvix-input-to-string-list "▬▮"))
("rew" . ,(juvix-input-to-string-list "▭▯"))
;; Parallelograms.
("pa" . ,(minijuvix-input-to-string-list "▰▱"))
("pa" . ,(juvix-input-to-string-list "▰▱"))
("pab" . (""))
("paw" . (""))
;; Diamonds.
("di" . ,(minijuvix-input-to-string-list "◆◇◈"))
("di" . ,(juvix-input-to-string-list "◆◇◈"))
("dib" . (""))
("diw" . (""))
("di." . (""))
;; Circles.
("ci" . ,(minijuvix-input-to-string-list "●○◎◌◯◍◐◑◒◓◔◕◖◗◠◡◴◵◶◷⚆⚇⚈⚉"))
("ci" . ,(juvix-input-to-string-list "●○◎◌◯◍◐◑◒◓◔◕◖◗◠◡◴◵◶◷⚆⚇⚈⚉"))
("cib" . (""))
("ciw" . (""))
("ci." . (""))
@ -502,8 +502,8 @@ order for the change to take effect."
;; Stars.
("st" . ,(minijuvix-input-to-string-list "⋆✦✧✶✴✹ ★☆✪✫✯✰✵✷✸"))
("st4" . ,(minijuvix-input-to-string-list "✦✧"))
("st" . ,(juvix-input-to-string-list "⋆✦✧✶✴✹ ★☆✪✫✯✰✵✷✸"))
("st4" . ,(juvix-input-to-string-list "✦✧"))
("st6" . (""))
("st8" . (""))
("st12" . (""))
@ -596,8 +596,8 @@ order for the change to take effect."
;; Parentheses.
("(" . ,(minijuvix-input-to-string-list "([{⁅⁽₍〈⎴⟅⟦⟨⟪⦃〈《「『【〔〖〚︵︷︹︻︽︿﹁﹃﹙﹛﹝([{「❪❬❰❲❴⟮⦅⦗⧼⸨❮⦇⦉"))
(")" . ,(minijuvix-input-to-string-list ")]}⁆⁾₎〉⎵⟆⟧⟩⟫⦄〉》」』】〕〗〛︶︸︺︼︾﹀﹂﹄﹚﹜﹞)]}」❫❭❱❳❵⟯⦆⦘⧽⸩❯⦈⦊"))
("(" . ,(juvix-input-to-string-list "([{⁅⁽₍〈⎴⟅⟦⟨⟪⦃〈《「『【〔〖〚︵︷︹︻︽︿﹁﹃﹙﹛﹝([{「❪❬❰❲❴⟮⦅⦗⧼⸨❮⦇⦉"))
(")" . ,(juvix-input-to-string-list ")]}⁆⁾₎〉⎵⟆⟧⟩⟫⦄〉》」』】〕〗〛︶︸︺︼︾﹀﹂﹄﹚﹜﹞)]}」❫❭❱❳❵⟯⦆⦘⧽⸩❯⦈⦊"))
("[[" . (""))
("]]" . (""))
@ -625,23 +625,23 @@ order for the change to take effect."
;; Primes.
("'" . ,(minijuvix-input-to-string-list "′″‴⁗"))
("`" . ,(minijuvix-input-to-string-list "‵‶‷"))
("'" . ,(juvix-input-to-string-list "′″‴⁗"))
("`" . ,(juvix-input-to-string-list "‵‶‷"))
;; Fractions.
("frac" . ,(minijuvix-input-to-string-list "¼½¾⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞⅟"))
("frac" . ,(juvix-input-to-string-list "¼½¾⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞⅟"))
;; Bullets.
("bu" . ,(minijuvix-input-to-string-list "•◦‣⁌⁍"))
("bu" . ,(juvix-input-to-string-list "•◦‣⁌⁍"))
("bub" . (""))
("buw" . (""))
("but" . (""))
;; Musical symbols.
("note" . ,(minijuvix-input-to-string-list "♩♪♫♬"))
("note" . ,(juvix-input-to-string-list "♩♪♫♬"))
("b" . (""))
("#" . (""))
@ -654,12 +654,12 @@ order for the change to take effect."
("??" . (""))
("?!" . ("" ""))
("!?" . (""))
("die" . ,(minijuvix-input-to-string-list "⚀⚁⚂⚃⚄⚅"))
("asterisk" . ,(minijuvix-input-to-string-list "⁎⁑⁂✢✣✤✥✱✲✳✺✻✼✽❃❉❊❋"))
("die" . ,(juvix-input-to-string-list "⚀⚁⚂⚃⚄⚅"))
("asterisk" . ,(juvix-input-to-string-list "⁎⁑⁂✢✣✤✥✱✲✳✺✻✼✽❃❉❊❋"))
("8<" . ("" ""))
("tie" . (""))
("undertie" . (""))
("apl" . ,(minijuvix-input-to-string-list "⌶⌷⌸⌹⌺⌻⌼⌽⌾⌿⍀⍁⍂⍃⍄⍅⍆⍇⍈
("apl" . ,(juvix-input-to-string-list "⌶⌷⌸⌹⌺⌻⌼⌽⌾⌿⍀⍁⍂⍃⍄⍅⍆⍇⍈
"))
@ -670,22 +670,22 @@ order for the change to take effect."
;; translations:
;; ̀ ́ ̂ ̃ ̄ ̆ ̇ ̈ ̋ ̌ ̣ ̧ ̱
("^--" . ,(minijuvix-input-to-string-list"̅̿"))
("_--" . ,(minijuvix-input-to-string-list"̲̳"))
("^~" . ,(minijuvix-input-to-string-list"̃͌"))
("^--" . ,(juvix-input-to-string-list"̅̿"))
("_--" . ,(juvix-input-to-string-list"̲̳"))
("^~" . ,(juvix-input-to-string-list"̃͌"))
("_~" . ( "̰"))
("^." . ,(minijuvix-input-to-string-list"̇̈⃛⃜"))
("_." . ,(minijuvix-input-to-string-list"̣̤"))
("^l" . ,(minijuvix-input-to-string-list"⃖⃐⃔"))
("^." . ,(juvix-input-to-string-list"̇̈⃛⃜"))
("_." . ,(juvix-input-to-string-list"̣̤"))
("^l" . ,(juvix-input-to-string-list"⃖⃐⃔"))
("^l-" . ( ""))
("^r" . ,(minijuvix-input-to-string-list"⃗⃑⃕"))
("^r" . ,(juvix-input-to-string-list"⃗⃑⃕"))
("^r-" . ( ""))
("^lr" . ( ""))
("_lr" . ( "͍"))
("^^" . ,(minijuvix-input-to-string-list"̂̑͆"))
("_^" . ,(minijuvix-input-to-string-list"̭̯̪"))
("^v" . ,(minijuvix-input-to-string-list"̌̆"))
("_v" . ,(minijuvix-input-to-string-list"̬̮̺"))
("^^" . ,(juvix-input-to-string-list"̂̑͆"))
("_^" . ,(juvix-input-to-string-list"̭̯̪"))
("^v" . ,(juvix-input-to-string-list"̌̆"))
("_v" . ,(juvix-input-to-string-list"̬̮̺"))
;; Shorter forms of many greek letters plus ƛ.
@ -1094,57 +1094,57 @@ order for the change to take effect."
;; Circled, parenthesised etc. numbers and letters.
( "(0)" . ,(minijuvix-input-to-string-list " ⓪🄀⓿🄋🄌"))
( "(1)" . ,(minijuvix-input-to-string-list "⑴①⒈❶➀➊"))
( "(2)" . ,(minijuvix-input-to-string-list "⑵②⒉❷➁➋"))
( "(3)" . ,(minijuvix-input-to-string-list "⑶③⒊❸➂➌"))
( "(4)" . ,(minijuvix-input-to-string-list "⑷④⒋❹➃➍"))
( "(5)" . ,(minijuvix-input-to-string-list "⑸⑤⒌❺➄➎"))
( "(6)" . ,(minijuvix-input-to-string-list "⑹⑥⒍❻➅➏"))
( "(7)" . ,(minijuvix-input-to-string-list "⑺⑦⒎❼➆➐"))
( "(8)" . ,(minijuvix-input-to-string-list "⑻⑧⒏❽➇➑"))
( "(9)" . ,(minijuvix-input-to-string-list "⑼⑨⒐❾➈➒"))
("(10)" . ,(minijuvix-input-to-string-list "⑽⑩⒑❿➉➓"))
("(11)" . ,(minijuvix-input-to-string-list "⑾⑪⒒⓫"))
("(12)" . ,(minijuvix-input-to-string-list "⑿⑫⒓⓬"))
("(13)" . ,(minijuvix-input-to-string-list "⒀⑬⒔⓭"))
("(14)" . ,(minijuvix-input-to-string-list "⒁⑭⒕⓮"))
("(15)" . ,(minijuvix-input-to-string-list "⒂⑮⒖⓯"))
("(16)" . ,(minijuvix-input-to-string-list "⒃⑯⒗⓰"))
("(17)" . ,(minijuvix-input-to-string-list "⒄⑰⒘⓱"))
("(18)" . ,(minijuvix-input-to-string-list "⒅⑱⒙⓲"))
("(19)" . ,(minijuvix-input-to-string-list "⒆⑲⒚⓳"))
("(20)" . ,(minijuvix-input-to-string-list "⒇⑳⒛⓴"))
( "(0)" . ,(juvix-input-to-string-list " ⓪🄀⓿🄋🄌"))
( "(1)" . ,(juvix-input-to-string-list "⑴①⒈❶➀➊"))
( "(2)" . ,(juvix-input-to-string-list "⑵②⒉❷➁➋"))
( "(3)" . ,(juvix-input-to-string-list "⑶③⒊❸➂➌"))
( "(4)" . ,(juvix-input-to-string-list "⑷④⒋❹➃➍"))
( "(5)" . ,(juvix-input-to-string-list "⑸⑤⒌❺➄➎"))
( "(6)" . ,(juvix-input-to-string-list "⑹⑥⒍❻➅➏"))
( "(7)" . ,(juvix-input-to-string-list "⑺⑦⒎❼➆➐"))
( "(8)" . ,(juvix-input-to-string-list "⑻⑧⒏❽➇➑"))
( "(9)" . ,(juvix-input-to-string-list "⑼⑨⒐❾➈➒"))
("(10)" . ,(juvix-input-to-string-list "⑽⑩⒑❿➉➓"))
("(11)" . ,(juvix-input-to-string-list "⑾⑪⒒⓫"))
("(12)" . ,(juvix-input-to-string-list "⑿⑫⒓⓬"))
("(13)" . ,(juvix-input-to-string-list "⒀⑬⒔⓭"))
("(14)" . ,(juvix-input-to-string-list "⒁⑭⒕⓮"))
("(15)" . ,(juvix-input-to-string-list "⒂⑮⒖⓯"))
("(16)" . ,(juvix-input-to-string-list "⒃⑯⒗⓰"))
("(17)" . ,(juvix-input-to-string-list "⒄⑰⒘⓱"))
("(18)" . ,(juvix-input-to-string-list "⒅⑱⒙⓲"))
("(19)" . ,(juvix-input-to-string-list "⒆⑲⒚⓳"))
("(20)" . ,(juvix-input-to-string-list "⒇⑳⒛⓴"))
("(a)" . ,(minijuvix-input-to-string-list "⒜Ⓐⓐ🅐🄰🅰"))
("(b)" . ,(minijuvix-input-to-string-list "⒝Ⓑⓑ🅑🄱🅱"))
("(c)" . ,(minijuvix-input-to-string-list "⒞Ⓒⓒ🅒🄲🅲"))
("(d)" . ,(minijuvix-input-to-string-list "⒟Ⓓⓓ🅓🄳🅳"))
("(e)" . ,(minijuvix-input-to-string-list "⒠Ⓔⓔ🅔🄴🅴"))
("(f)" . ,(minijuvix-input-to-string-list "⒡Ⓕⓕ🅕🄵🅵"))
("(g)" . ,(minijuvix-input-to-string-list "⒢Ⓖⓖ🅖🄶🅶"))
("(h)" . ,(minijuvix-input-to-string-list "⒣Ⓗⓗ🅗🄷🅷"))
("(i)" . ,(minijuvix-input-to-string-list "⒤Ⓘⓘ🅘🄸🅸"))
("(j)" . ,(minijuvix-input-to-string-list "⒥Ⓙⓙ🅙🄹🅹"))
("(k)" . ,(minijuvix-input-to-string-list "⒦Ⓚⓚ🅚🄺🅺"))
("(l)" . ,(minijuvix-input-to-string-list "⒧Ⓛⓛ🅛🄻🅻"))
("(m)" . ,(minijuvix-input-to-string-list "⒨Ⓜⓜ🅜🄼🅼"))
("(n)" . ,(minijuvix-input-to-string-list "⒩Ⓝⓝ🅝🄽🅽"))
("(o)" . ,(minijuvix-input-to-string-list "⒪Ⓞⓞ🅞🄾🅾"))
("(p)" . ,(minijuvix-input-to-string-list "⒫Ⓟⓟ🅟🄿🅿"))
("(q)" . ,(minijuvix-input-to-string-list "⒬Ⓠⓠ🅠🅀🆀"))
("(r)" . ,(minijuvix-input-to-string-list "⒭Ⓡⓡ🅡🅁🆁"))
("(s)" . ,(minijuvix-input-to-string-list "⒮Ⓢⓢ🅢🅂🆂"))
("(t)" . ,(minijuvix-input-to-string-list "⒯Ⓣⓣ🅣🅃🆃"))
("(u)" . ,(minijuvix-input-to-string-list "⒰Ⓤⓤ🅤🅄🆄"))
("(v)" . ,(minijuvix-input-to-string-list "⒱Ⓥⓥ🅥🅅🆅"))
("(w)" . ,(minijuvix-input-to-string-list "⒲Ⓦⓦ🅦🅆🆆"))
("(x)" . ,(minijuvix-input-to-string-list "⒳Ⓧⓧ🅧🅇🆇"))
("(y)" . ,(minijuvix-input-to-string-list "⒴Ⓨⓨ🅨🅈🆈"))
("(z)" . ,(minijuvix-input-to-string-list "⒵Ⓩⓩ🅩🅉🆉"))
("(a)" . ,(juvix-input-to-string-list "⒜Ⓐⓐ🅐🄰🅰"))
("(b)" . ,(juvix-input-to-string-list "⒝Ⓑⓑ🅑🄱🅱"))
("(c)" . ,(juvix-input-to-string-list "⒞Ⓒⓒ🅒🄲🅲"))
("(d)" . ,(juvix-input-to-string-list "⒟Ⓓⓓ🅓🄳🅳"))
("(e)" . ,(juvix-input-to-string-list "⒠Ⓔⓔ🅔🄴🅴"))
("(f)" . ,(juvix-input-to-string-list "⒡Ⓕⓕ🅕🄵🅵"))
("(g)" . ,(juvix-input-to-string-list "⒢Ⓖⓖ🅖🄶🅶"))
("(h)" . ,(juvix-input-to-string-list "⒣Ⓗⓗ🅗🄷🅷"))
("(i)" . ,(juvix-input-to-string-list "⒤Ⓘⓘ🅘🄸🅸"))
("(j)" . ,(juvix-input-to-string-list "⒥Ⓙⓙ🅙🄹🅹"))
("(k)" . ,(juvix-input-to-string-list "⒦Ⓚⓚ🅚🄺🅺"))
("(l)" . ,(juvix-input-to-string-list "⒧Ⓛⓛ🅛🄻🅻"))
("(m)" . ,(juvix-input-to-string-list "⒨Ⓜⓜ🅜🄼🅼"))
("(n)" . ,(juvix-input-to-string-list "⒩Ⓝⓝ🅝🄽🅽"))
("(o)" . ,(juvix-input-to-string-list "⒪Ⓞⓞ🅞🄾🅾"))
("(p)" . ,(juvix-input-to-string-list "⒫Ⓟⓟ🅟🄿🅿"))
("(q)" . ,(juvix-input-to-string-list "⒬Ⓠⓠ🅠🅀🆀"))
("(r)" . ,(juvix-input-to-string-list "⒭Ⓡⓡ🅡🅁🆁"))
("(s)" . ,(juvix-input-to-string-list "⒮Ⓢⓢ🅢🅂🆂"))
("(t)" . ,(juvix-input-to-string-list "⒯Ⓣⓣ🅣🅃🆃"))
("(u)" . ,(juvix-input-to-string-list "⒰Ⓤⓤ🅤🅄🆄"))
("(v)" . ,(juvix-input-to-string-list "⒱Ⓥⓥ🅥🅅🆅"))
("(w)" . ,(juvix-input-to-string-list "⒲Ⓦⓦ🅦🅆🆆"))
("(x)" . ,(juvix-input-to-string-list "⒳Ⓧⓧ🅧🅇🆇"))
("(y)" . ,(juvix-input-to-string-list "⒴Ⓨⓨ🅨🅈🆈"))
("(z)" . ,(juvix-input-to-string-list "⒵Ⓩⓩ🅩🅉🆉"))
))
"A list of translations specific to the minijuvix input method.
"A list of translations specific to the juvix input method.
Each element is a pair (KEY-SEQUENCE-STRING . LIST-OF-TRANSLATION-STRINGS).
All the translation strings are possible translations
of the given key sequence; if there is more than one you can choose
@ -1154,30 +1154,30 @@ Note that if you customize this setting you will not
automatically benefit (or suffer) from modifications to its
default value when the library is updated. If you just want to
add some bindings it is probably a better idea to customize
`minijuvix-input-user-translations'.
`juvix-input-user-translations'.
These translation pairs are included after those in
`minijuvix-input-user-translations', but before the ones inherited
from other input methods (see `minijuvix-input-inherit').
`juvix-input-user-translations', but before the ones inherited
from other input methods (see `juvix-input-inherit').
If you change this setting manually (without using the
customization buffer) you need to call `minijuvix-input-setup' in
customization buffer) you need to call `juvix-input-setup' in
order for the change to take effect."
:group 'minijuvix-input
:set 'minijuvix-input-incorporate-changed-setting
:group 'juvix-input
:set 'juvix-input-incorporate-changed-setting
:initialize 'custom-initialize-default
:type '(repeat (cons (string :tag "Key sequence")
(repeat :tag "Translations" string))))
(defcustom minijuvix-input-user-translations nil
"Like `minijuvix-input-translations', but more suitable for user
(defcustom juvix-input-user-translations nil
"Like `juvix-input-translations', but more suitable for user
customizations since by default it is empty.
These translation pairs are included first, before those in
`minijuvix-input-translations' and the ones inherited from other input
`juvix-input-translations' and the ones inherited from other input
methods."
:group 'minijuvix-input
:set 'minijuvix-input-incorporate-changed-setting
:group 'juvix-input
:set 'juvix-input-incorporate-changed-setting
:initialize 'custom-initialize-default
:type '(repeat (cons (string :tag "Key sequence")
(repeat :tag "Translations" string))))
@ -1185,7 +1185,7 @@ methods."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Inspecting and modifying translation maps
(defun minijuvix-input-get-translations (qp)
(defun juvix-input-get-translations (qp)
"Return a list containing all translations from the Quail
package QP (except for those corresponding to ASCII).
Each pair in the list has the form (KEY-SEQUENCE . TRANSLATION)."
@ -1197,75 +1197,75 @@ Each pair in the list has the form (KEY-SEQUENCE . TRANSLATION)."
(quail-build-decode-map (list (quail-map)) "" decode-map 0)
(cdr decode-map))))
(defun minijuvix-input-show-translations (qp)
(defun juvix-input-show-translations (qp)
"Display all translations used by the Quail package QP (a string).
\(Except for those corresponding to ASCII)."
(interactive (list (read-input-method-name
"Quail input method (default %s): " "minijuvix")))
"Quail input method (default %s): " "juvix")))
(let ((buf (concat "*" qp " input method translations*")))
(with-output-to-temp-buffer buf
(with-current-buffer buf
(quail-insert-decode-map
(cons 'decode-map (minijuvix-input-get-translations qp)))))))
(cons 'decode-map (juvix-input-get-translations qp)))))))
(defun minijuvix-input-add-translations (trans)
"Add the given translations TRANS to the minijuvix input method.
(defun juvix-input-add-translations (trans)
"Add the given translations TRANS to the juvix input method.
TRANS is a list of pairs (KEY-SEQUENCE . TRANSLATION). The
translations are appended to the current translations."
(with-temp-buffer
(dolist (tr (minijuvix-input-concat-map (eval minijuvix-input-tweak-all) trans))
(quail-defrule (car tr) (cdr tr) "minijuvix" t))))
(dolist (tr (juvix-input-concat-map (eval juvix-input-tweak-all) trans))
(quail-defrule (car tr) (cdr tr) "juvix" t))))
(defun minijuvix-input-inherit-package (qp &optional fun)
"Let the minijuvix input method inherit the translations from the
(defun juvix-input-inherit-package (qp &optional fun)
"Let the juvix input method inherit the translations from the
Quail package QP (except for those corresponding to ASCII).
The optional function FUN can be used to modify the translations.
It is given a pair (KEY-SEQUENCE . TRANSLATION) and should return
a list of such pairs."
(let ((trans (minijuvix-input-get-translations qp)))
(minijuvix-input-add-translations
(if fun (minijuvix-input-concat-map fun trans)
(let ((trans (juvix-input-get-translations qp)))
(juvix-input-add-translations
(if fun (juvix-input-concat-map fun trans)
trans))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Setting up the input method
(defun minijuvix-input-setup ()
"Set up the minijuvix input method based on the customisable
(defun juvix-input-setup ()
"Set up the juvix input method based on the customisable
variables and underlying input methods."
;; Create (or reset) the input method.
(with-temp-buffer
(quail-define-package "minijuvix" "UTF-8" "" t ; guidance
"minijuvix input method.
The purpose of this input method is to edit MiniJuvix programs, but
(quail-define-package "juvix" "UTF-8" "" t ; guidance
"juvix input method.
The purpose of this input method is to edit Juvix programs, but
since it is highly customisable it can be made useful for other
tasks as well."
nil nil nil nil nil nil t ; maximum-shortest
))
(minijuvix-input-add-translations
(juvix-input-add-translations
(mapcar (lambda (tr) (cons (car tr) (vconcat (cdr tr))))
(append minijuvix-input-user-translations
minijuvix-input-translations)))
(dolist (def minijuvix-input-inherit)
(minijuvix-input-inherit-package (car def)
(append juvix-input-user-translations
juvix-input-translations)))
(dolist (def juvix-input-inherit)
(juvix-input-inherit-package (car def)
(eval (cdr def)))))
(defun minijuvix-input-incorporate-changed-setting (sym val)
"Update the minijuvix input method based on the customisable
(defun juvix-input-incorporate-changed-setting (sym val)
"Update the juvix input method based on the customisable
variables and underlying input methods.
Suitable for use in the :set field of `defcustom'."
(set-default sym val)
(minijuvix-input-setup))
(juvix-input-setup))
;; Set up the input method.
(minijuvix-input-setup)
(juvix-input-setup)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Administrative details
(provide 'minijuvix-input)
;;; minijuvix-input.el ends here
(provide 'juvix-input)
;;; juvix-input.el ends here

66
juvix-mode/juvix-mode.el Normal file
View File

@ -0,0 +1,66 @@
(require 'juvix-customize)
(require 'juvix-highlight)
(require 'juvix-input)
(require 'flycheck-juvix)
(defgroup juvix nil
"Major mode for Juvix files."
:group 'languages)
(defvar juvix-mode-map
(let ((map (make-sparse-keymap))
(menu-map (make-sparse-keymap "Juvix")))
(define-key map (kbd "C-c C-l") 'juvix-load)
(define-key map (kbd "M-.") 'juvix-goto-definition)
map)
"Keymap for Juvix mode.")
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.m?juvix\\'" . juvix-mode))
(define-derived-mode juvix-mode prog-mode "Juvix-v0.2.1"
(font-lock-mode 0)
(when juvix-auto-input-method
(set-input-method "juvix")
)
(setq-local comment-start "--")
(add-hook
'juvix-mode-hook
(lambda ()
(with-eval-after-load 'evil
(evil-define-key 'normal juvix-mode-map (kbd "SPC m l") 'juvix-load)
(evil-define-key 'normal juvix-mode-map (kbd "SPC m g") 'juvix-goto-definition)
(evil-define-key 'normal juvix-mode-map (kbd "g d") 'juvix-goto-definition)
(evil-normalize-keymaps))))
)
(defun juvix-clear-annotations ()
"Remove all annotations from the current buffer."
(interactive)
(remove-list-of-text-properties (point-min) (point-max)
'(face))
)
(defun juvix-load ()
"Load current buffer."
(interactive)
(save-buffer)
(juvix-clear-annotations)
(eval (read (shell-command-to-string (concat "juvix highlight " (if juvix-disable-embedded-stdlib "--no-stdlib " "") (buffer-file-name)))))
(save-buffer)
)
(defun juvix-goto-definition ()
"Go to the definition of the symbol at point."
(interactive)
(let ((goto-info (get-text-property (point) 'juvix-goto)))
(if goto-info
(progn
(find-file (car goto-info))
(juvix-load)
(goto-char (cdr goto-info)))
(message "No goto information found at cursor"))))
(provide 'juvix-mode)

1
juvix-stdlib Submodule

@ -0,0 +1 @@
Subproject commit 223a87038bef8381423dda8824db18ea47b49c4e

View File

@ -10,9 +10,9 @@
typedef __UINTPTR_TYPE__ uintptr_t;
typedef struct minijuvix_function {
typedef struct juvix_function {
uintptr_t fun;
} minijuvix_function_t;
} juvix_function_t;
char* intToStr(int i) {
int length = snprintf(NULL, 0, "%d", i);

View File

@ -10,9 +10,9 @@ typedef __UINT16_TYPE__ uint16_t;
typedef __UINT32_TYPE__ uint32_t;
typedef __UINTPTR_TYPE__ uintptr_t;
typedef struct minijuvix_function {
typedef struct juvix_function {
uintptr_t fun;
} minijuvix_function_t;
} juvix_function_t;
/**
* Allocator

View File

@ -1,12 +0,0 @@
(defcustom minijuvix-auto-input-method t
"Automatically set the input method in minijuvix files."
:type 'boolean
:group 'minijuvix)
(defcustom minijuvix-disable-embedded-stdlib nil
"Disable the embedded standard library."
:type 'boolean
:group 'minijuvix)
(provide 'minijuvix-customize)

View File

@ -1,66 +0,0 @@
(require 'minijuvix-customize)
(require 'minijuvix-highlight)
(require 'minijuvix-input)
(require 'flycheck-minijuvix)
(defgroup minijuvix nil
"Major mode for MiniJuvix files."
:group 'languages)
(defvar minijuvix-mode-map
(let ((map (make-sparse-keymap))
(menu-map (make-sparse-keymap "MiniJuvix")))
(define-key map (kbd "C-c C-l") 'minijuvix-load)
(define-key map (kbd "M-.") 'minijuvix-goto-definition)
map)
"Keymap for MiniJuvix mode.")
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.m?juvix\\'" . minijuvix-mode))
(define-derived-mode minijuvix-mode prog-mode "MiniJuvix"
(font-lock-mode 0)
(when minijuvix-auto-input-method
(set-input-method "minijuvix")
)
(setq-local comment-start "--")
(add-hook
'minijuvix-mode-hook
(lambda ()
(with-eval-after-load 'evil
(evil-define-key 'normal minijuvix-mode-map (kbd "SPC m l") 'minijuvix-load)
(evil-define-key 'normal minijuvix-mode-map (kbd "SPC m g") 'minijuvix-goto-definition)
(evil-define-key 'normal minijuvix-mode-map (kbd "g d") 'minijuvix-goto-definition)
(evil-normalize-keymaps))))
)
(defun minijuvix-clear-annotations ()
"Remove all annotations from the current buffer."
(interactive)
(remove-list-of-text-properties (point-min) (point-max)
'(face))
)
(defun minijuvix-load ()
"Load current buffer."
(interactive)
(save-buffer)
(minijuvix-clear-annotations)
(eval (read (shell-command-to-string (concat "minijuvix highlight " (if minijuvix-disable-embedded-stdlib "--no-stdlib " "") (buffer-file-name)))))
(save-buffer)
)
(defun minijuvix-goto-definition ()
"Go to the definition of the symbol at point."
(interactive)
(let ((goto-info (get-text-property (point) 'minijuvix-goto)))
(if goto-info
(progn
(find-file (car goto-info))
(minijuvix-load)
(goto-char (cdr goto-info)))
(message "No goto information found at cursor"))))
(provide 'minijuvix-mode)

@ -1 +0,0 @@
Subproject commit 23515f6c295235bf51d828287db56e0b51c67582

View File

@ -1,16 +1,16 @@
name: minijuvix
version: 0.2.0
name: juvix
version: 0.2.1
license: GPL-3.0-only
license-file: LICENSE
copyright: (c) 2022- Heliax AG.
maintainer: The PLT Team at Heliax AG <hello@heliax.dev>
author: [ Jonathan Prieto-Cubides , Jan Mas Rovira , Paul Cadman ]
author: [ Jonathan Prieto-Cubides , Jan Mas Rovira , Paul Cadman , Github's contributors ]
tested-with: ghc == 9.2.3
homepage: https://github.com/heliaxdev/minijuvix
bug-reports: https://github.com/heliaxdev/minijuvix/issues
description: The MiniJuvix compiler
homepage: https://github.com/anoma/juvix
bug-reports: https://github.com/anoma/juvix/issues
description: The Juvix compiler
category: Compilers/Interpreters
github: heliaxdev/minijuvix
github: anoma/juvix
extra-source-files:
- README.org
@ -51,7 +51,7 @@ dependencies:
- unordered-containers == 0.2.*
# the tasty dependencies are here to avoid having to recompile
# minijuvix when running the tests.
# juvix when running the tests.
- tasty
- tasty-hunit
- Diff == 0.4.*
@ -96,20 +96,20 @@ library:
default-language: GHC2021
executables:
minijuvix:
juvix:
main: Main.hs
source-dirs: app
dependencies:
- minijuvix
- juvix
- optparse-applicative == 0.17.*
verbatim:
default-language: GHC2021
tests:
minijuvix-test:
juvix-test:
main: Main.hs
source-dirs: test
dependencies:
- minijuvix
- juvix
verbatim:
default-language: GHC2021

10
src/Juvix/Builtins.hs Normal file
View File

@ -0,0 +1,10 @@
module Juvix.Builtins
( module Juvix.Builtins.Effect,
module Juvix.Builtins.Natural,
module Juvix.Builtins.IO,
)
where
import Juvix.Builtins.Effect
import Juvix.Builtins.IO
import Juvix.Builtins.Natural

View File

@ -1,11 +1,11 @@
module MiniJuvix.Builtins.Base
( module MiniJuvix.Builtins.Base,
module Juvix.Builtins.Base
( module Juvix.Builtins.Base,
)
where
import MiniJuvix.Internal.Strings qualified as Str
import MiniJuvix.Prelude
import MiniJuvix.Prelude.Pretty
import Juvix.Internal.Strings qualified as Str
import Juvix.Prelude
import Juvix.Prelude.Pretty
data BuiltinsEnum
= BuiltinsNatural

View File

@ -1,11 +1,11 @@
module MiniJuvix.Builtins.Effect
( module MiniJuvix.Builtins.Effect,
module Juvix.Builtins.Effect
( module Juvix.Builtins.Effect,
)
where
import MiniJuvix.Builtins.Error
import MiniJuvix.Prelude
import MiniJuvix.Syntax.Abstract.Language.Extra
import Juvix.Builtins.Error
import Juvix.Prelude
import Juvix.Syntax.Abstract.Language.Extra
data Builtins m a where
GetBuiltinName' :: Interval -> BuiltinPrim -> Builtins m Name
@ -30,14 +30,14 @@ makeLenses ''BuiltinsState
iniState :: BuiltinsState
iniState = BuiltinsState mempty mempty
re :: forall r a. Member (Error MiniJuvixError) r => Sem (Builtins ': r) a -> Sem (State BuiltinsState ': r) a
re :: forall r a. Member (Error JuvixError) r => Sem (Builtins ': r) a -> Sem (State BuiltinsState ': r) a
re = reinterpret $ \case
GetBuiltinName' i b -> fromMaybeM notDefined (gets (^. builtinsTable . at b))
where
notDefined :: Sem (State BuiltinsState : r) x
notDefined =
throw $
MiniJuvixError
JuvixError
NotDefined
{ _notDefinedBuiltin = b,
_notDefinedLoc = i
@ -54,11 +54,11 @@ re = reinterpret $ \case
alreadyDefined :: Sem (State BuiltinsState : r) x
alreadyDefined =
throw $
MiniJuvixError
JuvixError
AlreadyDefined
{ _alreadyDefinedBuiltin = b,
_alreadyDefinedLoc = getLoc n
}
runBuiltins :: Member (Error MiniJuvixError) r => Sem (Builtins ': r) a -> Sem r a
runBuiltins :: Member (Error JuvixError) r => Sem (Builtins ': r) a -> Sem r a
runBuiltins = evalState iniState . re

View File

@ -1,9 +1,9 @@
module MiniJuvix.Builtins.Error where
module Juvix.Builtins.Error where
import MiniJuvix.Prelude
import MiniJuvix.Prelude.Pretty
import MiniJuvix.Syntax.Concrete.Builtins
import MiniJuvix.Termination.Error.Pretty
import Juvix.Prelude
import Juvix.Prelude.Pretty
import Juvix.Syntax.Concrete.Builtins
import Juvix.Termination.Error.Pretty
data AlreadyDefined = AlreadyDefined
{ _alreadyDefinedBuiltin :: BuiltinPrim,

View File

@ -1,8 +1,8 @@
module MiniJuvix.Builtins.IO where
module Juvix.Builtins.IO where
import MiniJuvix.Builtins.Effect
import MiniJuvix.Prelude
import MiniJuvix.Syntax.Abstract.Language.Extra
import Juvix.Builtins.Effect
import Juvix.Prelude
import Juvix.Syntax.Abstract.Language.Extra
registerIO :: Member Builtins r => AxiomDef -> Sem r ()
registerIO d = do

View File

@ -1,11 +1,11 @@
module MiniJuvix.Builtins.Natural where
module Juvix.Builtins.Natural where
import Data.HashSet qualified as HashSet
import MiniJuvix.Builtins.Effect
import MiniJuvix.Internal.NameIdGen
import MiniJuvix.Prelude
import MiniJuvix.Syntax.Abstract.Language.Extra
import MiniJuvix.Syntax.Abstract.Pretty
import Juvix.Builtins.Effect
import Juvix.Internal.NameIdGen
import Juvix.Prelude
import Juvix.Syntax.Abstract.Language.Extra
import Juvix.Syntax.Abstract.Pretty
registerNaturalDef :: Member Builtins r => InductiveDef -> Sem r ()
registerNaturalDef d = do

View File

@ -1,12 +1,12 @@
module MiniJuvix.Internal.NameIdGen
( module MiniJuvix.Internal.NameIdGen,
module MiniJuvix.Syntax.NameId,
module Juvix.Internal.NameIdGen
( module Juvix.Internal.NameIdGen,
module Juvix.Syntax.NameId,
)
where
import Data.Stream (Stream (Cons))
import MiniJuvix.Prelude
import MiniJuvix.Syntax.NameId
import Juvix.Prelude
import Juvix.Syntax.NameId
allNameIds :: Stream NameId
allNameIds = NameId <$> ids

View File

@ -1,6 +1,6 @@
module MiniJuvix.Internal.Strings where
module Juvix.Internal.Strings where
import MiniJuvix.Prelude
import Juvix.Prelude
module_ :: IsString s => s
module_ = "module"
@ -230,5 +230,5 @@ minicRuntime = "minic-runtime.h"
putStrLn_ :: IsString s => s
putStrLn_ = "putStrLn"
minijuvixFunctionT :: IsString s => s
minijuvixFunctionT = "minijuvix_function_t"
juvixFunctionT :: IsString s => s
juvixFunctionT = "juvix_function_t"

154
src/Juvix/Pipeline.hs Normal file
View File

@ -0,0 +1,154 @@
module Juvix.Pipeline
( module Juvix.Pipeline,
module Juvix.Pipeline.EntryPoint,
)
where
import Juvix.Builtins
import Juvix.Internal.NameIdGen
import Juvix.Pipeline.EntryPoint
import Juvix.Pipeline.Setup qualified as Setup
import Juvix.Prelude
import Juvix.Syntax.Abstract.AbstractResult qualified as Abstract
import Juvix.Syntax.Concrete.Parser qualified as Parser
import Juvix.Syntax.Concrete.Scoped.Scoper qualified as Scoper
import Juvix.Syntax.MicroJuvix.ArityChecker qualified as MicroJuvix
import Juvix.Syntax.MicroJuvix.MicroJuvixResult qualified as MicroJuvix
import Juvix.Syntax.MicroJuvix.MicroJuvixTypedResult qualified as MicroJuvix
import Juvix.Syntax.MicroJuvix.TypeChecker qualified as MicroJuvix
import Juvix.Translation.AbstractToMicroJuvix qualified as MicroJuvix
import Juvix.Translation.MicroJuvixToMonoJuvix qualified as MonoJuvix
import Juvix.Translation.MonoJuvixToMiniC qualified as MiniC
import Juvix.Translation.MonoJuvixToMiniHaskell qualified as MiniHaskell
import Juvix.Translation.ScopedToAbstract qualified as Abstract
type PipelineEff = '[Files, NameIdGen, Builtins, Error JuvixError, Embed IO]
runIOEither :: Sem PipelineEff a -> IO (Either JuvixError a)
runIOEither = runM . runError . runBuiltins . runNameIdGen . mapError (JuvixError @FilesError) . runFilesIO
runIO :: Sem PipelineEff a -> IO a
runIO = runIOEither >=> mayThrow
where
mayThrow :: Either JuvixError r -> IO r
mayThrow = \case
Left err -> printErrorAnsiSafe err >> exitFailure
Right r -> return r
--------------------------------------------------------------------------------
upToSetup ::
Member Files r =>
EntryPoint ->
Sem r EntryPoint
upToSetup = Setup.entrySetup
upToParsing ::
Members '[Files, Error JuvixError] r =>
EntryPoint ->
Sem r Parser.ParserResult
upToParsing = upToSetup >=> pipelineParser
upToScoping ::
Members '[Files, NameIdGen, Error JuvixError] r =>
EntryPoint ->
Sem r Scoper.ScoperResult
upToScoping = upToParsing >=> pipelineScoper
upToAbstract ::
Members '[Files, NameIdGen, Builtins, Error JuvixError] r =>
EntryPoint ->
Sem r Abstract.AbstractResult
upToAbstract = upToScoping >=> pipelineAbstract
upToMicroJuvix ::
Members '[Files, NameIdGen, Builtins, Error JuvixError] r =>
EntryPoint ->
Sem r MicroJuvix.MicroJuvixResult
upToMicroJuvix = upToAbstract >=> pipelineMicroJuvix
upToMicroJuvixArity ::
Members '[Files, NameIdGen, Builtins, Error JuvixError] r =>
EntryPoint ->
Sem r MicroJuvix.MicroJuvixArityResult
upToMicroJuvixArity = upToMicroJuvix >=> pipelineMicroJuvixArity
upToMicroJuvixTyped ::
Members '[Files, NameIdGen, Builtins, Error JuvixError] r =>
EntryPoint ->
Sem r MicroJuvix.MicroJuvixTypedResult
upToMicroJuvixTyped = upToMicroJuvixArity >=> pipelineMicroJuvixTyped
upToMonoJuvix ::
Members '[Files, NameIdGen, Builtins, Error JuvixError] r =>
EntryPoint ->
Sem r MonoJuvix.MonoJuvixResult
upToMonoJuvix = upToMicroJuvixTyped >=> pipelineMonoJuvix
upToMiniHaskell ::
Members '[Files, NameIdGen, Builtins, Error JuvixError] r =>
EntryPoint ->
Sem r MiniHaskell.MiniHaskellResult
upToMiniHaskell = upToMonoJuvix >=> pipelineMiniHaskell
upToMiniC ::
Members '[Files, NameIdGen, Builtins, Error JuvixError] r =>
EntryPoint ->
Sem r MiniC.MiniCResult
upToMiniC = upToMonoJuvix >=> pipelineMiniC
--------------------------------------------------------------------------------
pipelineParser ::
Members '[Files, Error JuvixError] r =>
EntryPoint ->
Sem r Parser.ParserResult
pipelineParser = mapError (JuvixError @Parser.ParserError) . Parser.entryParser
pipelineScoper ::
Members '[Files, NameIdGen, Error JuvixError] r =>
Parser.ParserResult ->
Sem r Scoper.ScoperResult
pipelineScoper = mapError (JuvixError @Scoper.ScoperError) . Scoper.entryScoper
pipelineAbstract ::
Members '[Error JuvixError, Builtins, NameIdGen] r =>
Scoper.ScoperResult ->
Sem r Abstract.AbstractResult
pipelineAbstract = mapError (JuvixError @Scoper.ScoperError) . Abstract.entryAbstract
pipelineMicroJuvix ::
Members '[Error JuvixError] r =>
Abstract.AbstractResult ->
Sem r MicroJuvix.MicroJuvixResult
pipelineMicroJuvix = MicroJuvix.entryMicroJuvix
pipelineMicroJuvixArity ::
Members '[Error JuvixError, NameIdGen] r =>
MicroJuvix.MicroJuvixResult ->
Sem r MicroJuvix.MicroJuvixArityResult
pipelineMicroJuvixArity = mapError (JuvixError @MicroJuvix.ArityCheckerError) . MicroJuvix.entryMicroJuvixArity
pipelineMicroJuvixTyped ::
Members '[Files, NameIdGen, Error JuvixError] r =>
MicroJuvix.MicroJuvixArityResult ->
Sem r MicroJuvix.MicroJuvixTypedResult
pipelineMicroJuvixTyped =
mapError (JuvixError @MicroJuvix.TypeCheckerError) . MicroJuvix.entryMicroJuvixTyped
pipelineMonoJuvix ::
Members '[Files, NameIdGen] r =>
MicroJuvix.MicroJuvixTypedResult ->
Sem r MonoJuvix.MonoJuvixResult
pipelineMonoJuvix = MonoJuvix.entryMonoJuvix
pipelineMiniHaskell ::
MonoJuvix.MonoJuvixResult ->
Sem r MiniHaskell.MiniHaskellResult
pipelineMiniHaskell = MiniHaskell.entryMiniHaskell
pipelineMiniC ::
Member Builtins r =>
MonoJuvix.MonoJuvixResult ->
Sem r MiniC.MiniCResult
pipelineMiniC = MiniC.entryMiniC

View File

@ -1,9 +1,9 @@
module MiniJuvix.Pipeline.EntryPoint
( module MiniJuvix.Pipeline.EntryPoint,
module Juvix.Pipeline.EntryPoint
( module Juvix.Pipeline.EntryPoint,
)
where
import MiniJuvix.Prelude
import Juvix.Prelude
-- | The head of _entryModulePaths is assumed to be the Main module
data EntryPoint = EntryPoint

View File

@ -1,15 +1,15 @@
module MiniJuvix.Pipeline.Setup where
module Juvix.Pipeline.Setup where
import Data.FileEmbed qualified as FE
import MiniJuvix.Pipeline.EntryPoint
import MiniJuvix.Prelude
import Juvix.Pipeline.EntryPoint
import Juvix.Prelude
stdlibDir :: [(FilePath, Text)]
stdlibDir =
let stdlibFiles :: [(FilePath, Text)]
stdlibFiles = second decodeUtf8 <$> $(FE.makeRelativeToProject "minijuvix-stdlib" >>= FE.embedDir)
stdlibFiles = second decodeUtf8 <$> $(FE.makeRelativeToProject "juvix-stdlib" >>= FE.embedDir)
isMjuvixFile :: (FilePath, Text) -> Bool
isMjuvixFile (fp, _) = takeExtension fp == ".mjuvix"
isMjuvixFile (fp, _) = takeExtension fp == ".juvix"
in filter isMjuvixFile stdlibFiles
entrySetup ::

12
src/Juvix/Prelude.hs Normal file
View File

@ -0,0 +1,12 @@
module Juvix.Prelude
( module Juvix.Prelude.Base,
module Juvix.Prelude.Error,
module Juvix.Prelude.Files,
module Juvix.Prelude.Lens,
)
where
import Juvix.Prelude.Base
import Juvix.Prelude.Error
import Juvix.Prelude.Files
import Juvix.Prelude.Lens

View File

@ -1,5 +1,5 @@
module MiniJuvix.Prelude.Base
( module MiniJuvix.Prelude.Base,
module Juvix.Prelude.Base
( module Juvix.Prelude.Base,
module Control.Applicative,
module Control.Monad.Extra,
module Control.Monad.Fix,

View File

@ -0,0 +1,21 @@
-- | Generic class of errors generated by the juvix compiler. Inspired by
-- Control.Exception
module Juvix.Prelude.Error
( module Juvix.Prelude.Error,
module Juvix.Syntax.Concrete.Loc,
module Juvix.Prelude.Error.GenericError,
)
where
import Juvix.Prelude.Base
import Juvix.Prelude.Error.GenericError
import Juvix.Syntax.Concrete.Loc
data JuvixError
= forall a. (ToGenericError a, Typeable a) => JuvixError a
instance ToGenericError JuvixError where
genericError (JuvixError e) = genericError e
fromJuvixError :: Typeable a => JuvixError -> Maybe a
fromJuvixError (JuvixError e) = cast e

View File

@ -1,11 +1,11 @@
module MiniJuvix.Prelude.Error.GenericError
( module MiniJuvix.Prelude.Error.GenericError,
module Juvix.Prelude.Error.GenericError
( module Juvix.Prelude.Error.GenericError,
)
where
import MiniJuvix.Prelude.Base
import MiniJuvix.Prelude.Pretty
import MiniJuvix.Syntax.Concrete.Loc
import Juvix.Prelude.Base
import Juvix.Prelude.Pretty
import Juvix.Syntax.Concrete.Loc
import Prettyprinter.Render.Terminal qualified as Ansi
import Prettyprinter.Render.Text
import System.Console.ANSI qualified as Ansi

View File

@ -1,12 +1,12 @@
module MiniJuvix.Prelude.Files
( module MiniJuvix.Prelude.Files,
module MiniJuvix.Prelude.Files.Error,
module Juvix.Prelude.Files
( module Juvix.Prelude.Files,
module Juvix.Prelude.Files.Error,
)
where
import Data.HashMap.Strict qualified as HashMap
import MiniJuvix.Prelude.Base
import MiniJuvix.Prelude.Files.Error
import Juvix.Prelude.Base
import Juvix.Prelude.Files.Error
data Files m a where
ReadFile' :: FilePath -> Files m Text

View File

@ -1,8 +1,8 @@
module MiniJuvix.Prelude.Files.Error where
module Juvix.Prelude.Files.Error where
import MiniJuvix.Prelude.Base
import MiniJuvix.Prelude.Error
import MiniJuvix.Prelude.Pretty
import Juvix.Prelude.Base
import Juvix.Prelude.Error
import Juvix.Prelude.Pretty
data FilesErrorCause = StdlibConflict
deriving stock (Show)

View File

@ -1,6 +1,6 @@
module MiniJuvix.Prelude.Lens where
module Juvix.Prelude.Lens where
import MiniJuvix.Prelude.Base
import Juvix.Prelude.Base
-- | points to the first element of a non-empty list.
_head :: Lens' (NonEmpty a) a

View File

@ -1,11 +1,11 @@
module MiniJuvix.Prelude.Pretty
( module MiniJuvix.Prelude.Pretty,
module Juvix.Prelude.Pretty
( module Juvix.Prelude.Pretty,
module Prettyprinter,
module Prettyprinter.Render.Terminal,
)
where
import MiniJuvix.Prelude.Base
import Juvix.Prelude.Base
import Prettyprinter hiding (hsep, vsep)
import Prettyprinter qualified as PP
import Prettyprinter.Render.Terminal (AnsiStyle)

View File

@ -0,0 +1,23 @@
module Juvix.Syntax.Abstract.AbstractResult
( module Juvix.Syntax.Abstract.AbstractResult,
module Juvix.Syntax.Abstract.InfoTable,
)
where
import Juvix.Pipeline.EntryPoint qualified as E
import Juvix.Prelude
import Juvix.Syntax.Abstract.InfoTable
import Juvix.Syntax.Abstract.Language
import Juvix.Syntax.Concrete.Parser.ParserResult
import Juvix.Syntax.Concrete.Scoped.Scoper.ScoperResult
data AbstractResult = AbstractResult
{ _resultScoper :: ScoperResult,
_resultTable :: InfoTable,
_resultModules :: NonEmpty TopModule
}
makeLenses ''AbstractResult
abstractResultEntryPoint :: Lens' AbstractResult E.EntryPoint
abstractResultEntryPoint = resultScoper . resultParserResult . resultEntry

View File

@ -1,8 +1,8 @@
module MiniJuvix.Syntax.Abstract.InfoTable where
module Juvix.Syntax.Abstract.InfoTable where
import MiniJuvix.Prelude
import MiniJuvix.Syntax.Abstract.Language
import MiniJuvix.Syntax.Concrete.Scoped.Name qualified as S
import Juvix.Prelude
import Juvix.Syntax.Abstract.Language
import Juvix.Syntax.Concrete.Scoped.Name qualified as S
newtype FunctionInfo = FunctionInfo
{ _functionInfoDef :: FunctionDef

View File

@ -1,13 +1,13 @@
module MiniJuvix.Syntax.Abstract.InfoTableBuilder
( module MiniJuvix.Syntax.Abstract.InfoTableBuilder,
module MiniJuvix.Syntax.Abstract.InfoTable,
module Juvix.Syntax.Abstract.InfoTableBuilder
( module Juvix.Syntax.Abstract.InfoTableBuilder,
module Juvix.Syntax.Abstract.InfoTable,
)
where
import Data.HashMap.Strict qualified as HashMap
import MiniJuvix.Prelude
import MiniJuvix.Syntax.Abstract.InfoTable
import MiniJuvix.Syntax.Abstract.Language
import Juvix.Prelude
import Juvix.Syntax.Abstract.InfoTable
import Juvix.Syntax.Abstract.Language
data InfoTableBuilder m a where
RegisterAxiom :: AxiomDef -> InfoTableBuilder m ()

View File

@ -1,25 +1,25 @@
module MiniJuvix.Syntax.Abstract.Language
( module MiniJuvix.Syntax.Abstract.Language,
module MiniJuvix.Syntax.Concrete.Language,
module MiniJuvix.Syntax.Hole,
module MiniJuvix.Syntax.Concrete.Builtins,
module MiniJuvix.Syntax.Usage,
module MiniJuvix.Syntax.Universe,
module MiniJuvix.Syntax.Abstract.Name,
module MiniJuvix.Syntax.Wildcard,
module MiniJuvix.Syntax.IsImplicit,
module Juvix.Syntax.Abstract.Language
( module Juvix.Syntax.Abstract.Language,
module Juvix.Syntax.Concrete.Language,
module Juvix.Syntax.Hole,
module Juvix.Syntax.Concrete.Builtins,
module Juvix.Syntax.Usage,
module Juvix.Syntax.Universe,
module Juvix.Syntax.Abstract.Name,
module Juvix.Syntax.Wildcard,
module Juvix.Syntax.IsImplicit,
)
where
import MiniJuvix.Prelude
import MiniJuvix.Syntax.Abstract.Name
import MiniJuvix.Syntax.Concrete.Builtins
import MiniJuvix.Syntax.Concrete.Language (BackendItem, ForeignBlock (..), LiteralLoc (..), symbolLoc)
import MiniJuvix.Syntax.Hole
import MiniJuvix.Syntax.IsImplicit
import MiniJuvix.Syntax.Universe
import MiniJuvix.Syntax.Usage
import MiniJuvix.Syntax.Wildcard
import Juvix.Prelude
import Juvix.Syntax.Abstract.Name
import Juvix.Syntax.Concrete.Builtins
import Juvix.Syntax.Concrete.Language (BackendItem, ForeignBlock (..), LiteralLoc (..), symbolLoc)
import Juvix.Syntax.Hole
import Juvix.Syntax.IsImplicit
import Juvix.Syntax.Universe
import Juvix.Syntax.Usage
import Juvix.Syntax.Wildcard
type LocalModule = Module

View File

@ -1,14 +1,14 @@
module MiniJuvix.Syntax.Abstract.Language.Extra
( module MiniJuvix.Syntax.Abstract.Language,
module MiniJuvix.Syntax.Abstract.Language.Extra,
module Juvix.Syntax.Abstract.Language.Extra
( module Juvix.Syntax.Abstract.Language,
module Juvix.Syntax.Abstract.Language.Extra,
)
where
import Data.HashMap.Strict qualified as HashMap
import Data.HashSet qualified as HashSet
import MiniJuvix.Internal.NameIdGen
import MiniJuvix.Prelude
import MiniJuvix.Syntax.Abstract.Language
import Juvix.Internal.NameIdGen
import Juvix.Prelude
import Juvix.Syntax.Abstract.Language
data ApplicationArg = ApplicationArg
{ _appArgIsImplicit :: IsImplicit,

View File

@ -1,16 +1,16 @@
module MiniJuvix.Syntax.Abstract.Name
( module MiniJuvix.Syntax.Abstract.Name,
module MiniJuvix.Syntax.Concrete.Scoped.Name.NameKind,
module MiniJuvix.Syntax.NameId,
module MiniJuvix.Syntax.Fixity,
module Juvix.Syntax.Abstract.Name
( module Juvix.Syntax.Abstract.Name,
module Juvix.Syntax.Concrete.Scoped.Name.NameKind,
module Juvix.Syntax.NameId,
module Juvix.Syntax.Fixity,
)
where
import MiniJuvix.Prelude
import MiniJuvix.Prelude.Pretty
import MiniJuvix.Syntax.Concrete.Scoped.Name.NameKind
import MiniJuvix.Syntax.Fixity
import MiniJuvix.Syntax.NameId
import Juvix.Prelude
import Juvix.Prelude.Pretty
import Juvix.Syntax.Concrete.Scoped.Name.NameKind
import Juvix.Syntax.Fixity
import Juvix.Syntax.NameId
data Name = Name
{ _nameText :: Text,

View File

@ -1,14 +1,14 @@
module MiniJuvix.Syntax.Abstract.Pretty
( module MiniJuvix.Syntax.Abstract.Pretty,
module MiniJuvix.Syntax.Abstract.Pretty.Options,
module Juvix.Syntax.Abstract.Pretty
( module Juvix.Syntax.Abstract.Pretty,
module Juvix.Syntax.Abstract.Pretty.Options,
)
where
import MiniJuvix.Prelude
import MiniJuvix.Prelude.Pretty
import MiniJuvix.Syntax.Abstract.Pretty.Ansi qualified as Ansi
import MiniJuvix.Syntax.Abstract.Pretty.Base
import MiniJuvix.Syntax.Abstract.Pretty.Options
import Juvix.Prelude
import Juvix.Prelude.Pretty
import Juvix.Syntax.Abstract.Pretty.Ansi qualified as Ansi
import Juvix.Syntax.Abstract.Pretty.Base
import Juvix.Syntax.Abstract.Pretty.Options
newtype PPOutput = PPOutput (Doc Ann)

View File

@ -1,8 +1,8 @@
module MiniJuvix.Syntax.Abstract.Pretty.Ann where
module Juvix.Syntax.Abstract.Pretty.Ann where
import MiniJuvix.Prelude
import MiniJuvix.Syntax.Concrete.Scoped.Name qualified as S
import MiniJuvix.Syntax.Concrete.Scoped.Pretty.Base qualified as S
import Juvix.Prelude
import Juvix.Syntax.Concrete.Scoped.Name qualified as S
import Juvix.Syntax.Concrete.Scoped.Pretty.Base qualified as S
data Ann
= AnnKind S.NameKind

View File

@ -1,11 +1,11 @@
module MiniJuvix.Syntax.Abstract.Pretty.Ansi
( module MiniJuvix.Syntax.Abstract.Pretty.Base,
module MiniJuvix.Syntax.Abstract.Pretty.Ansi,
module Juvix.Syntax.Abstract.Pretty.Ansi
( module Juvix.Syntax.Abstract.Pretty.Base,
module Juvix.Syntax.Abstract.Pretty.Ansi,
)
where
import MiniJuvix.Syntax.Abstract.Pretty.Base
import MiniJuvix.Syntax.Concrete.Scoped.Name.NameKind
import Juvix.Syntax.Abstract.Pretty.Base
import Juvix.Syntax.Concrete.Scoped.Name.NameKind
import Prettyprinter.Render.Terminal
stylize :: Ann -> AnsiStyle

View File

@ -1,16 +1,16 @@
module MiniJuvix.Syntax.Abstract.Pretty.Base
( module MiniJuvix.Syntax.Abstract.Pretty.Base,
module MiniJuvix.Syntax.Abstract.Pretty.Ann,
module MiniJuvix.Syntax.Abstract.Pretty.Options,
module Juvix.Syntax.Abstract.Pretty.Base
( module Juvix.Syntax.Abstract.Pretty.Base,
module Juvix.Syntax.Abstract.Pretty.Ann,
module Juvix.Syntax.Abstract.Pretty.Options,
)
where
import MiniJuvix.Internal.Strings qualified as Str
import MiniJuvix.Prelude
import MiniJuvix.Syntax.Abstract.Language.Extra
import MiniJuvix.Syntax.Abstract.Pretty.Ann
import MiniJuvix.Syntax.Abstract.Pretty.Options
import MiniJuvix.Syntax.Concrete.Scoped.Pretty.Base qualified as S
import Juvix.Internal.Strings qualified as Str
import Juvix.Prelude
import Juvix.Syntax.Abstract.Language.Extra
import Juvix.Syntax.Abstract.Pretty.Ann
import Juvix.Syntax.Abstract.Pretty.Options
import Juvix.Syntax.Concrete.Scoped.Pretty.Base qualified as S
import Prettyprinter
doc :: PrettyCode c => Options -> c -> Doc Ann

View File

@ -1,6 +1,6 @@
module MiniJuvix.Syntax.Abstract.Pretty.Options where
module Juvix.Syntax.Abstract.Pretty.Options where
import MiniJuvix.Prelude
import Juvix.Prelude
data Options = Options
{ _optShowNameIds :: Bool,

View File

@ -1,7 +1,7 @@
module MiniJuvix.Syntax.Abstract.Quasiquoter where
module Juvix.Syntax.Abstract.Quasiquoter where
-- ( module MiniJuvix.Syntax.Abstract.Quasiquoter,
-- module MiniJuvix.Syntax.Abstract.Language,
-- ( module Juvix.Syntax.Abstract.Quasiquoter,
-- module Juvix.Syntax.Abstract.Language,
-- )
-- where
@ -9,26 +9,26 @@ module MiniJuvix.Syntax.Abstract.Quasiquoter where
-- import Language.Haskell.TH (Exp, Q)
-- import Language.Haskell.TH.Quote (QuasiQuoter (..))
-- import Language.Haskell.TH.Syntax qualified as TH
-- import MiniJuvix.Internal.NameIdGen (runNameIdGen)
-- import MiniJuvix.Pipeline
-- import MiniJuvix.Prelude
-- import MiniJuvix.Syntax.Abstract.AbstractResult
-- import MiniJuvix.Syntax.Abstract.Language
-- import Juvix.Internal.NameIdGen (runNameIdGen)
-- import Juvix.Pipeline
-- import Juvix.Prelude
-- import Juvix.Syntax.Abstract.AbstractResult
-- import Juvix.Syntax.Abstract.Language
-- minijuvixQ :: Lift a => (Module -> a) -> QuasiQuoter
-- minijuvixQ proj =
-- juvixQ :: Lift a => (Module -> a) -> QuasiQuoter
-- juvixQ proj =
-- QuasiQuoter
-- { quotePat = impossible,
-- quoteType = impossible,
-- quoteDec = impossible,
-- quoteExp = minijuvixModule proj "Tmp" . wrapTmpModule
-- quoteExp = juvixModule proj "Tmp" . wrapTmpModule
-- }
-- where
-- wrapTmpModule :: String -> String
-- wrapTmpModule body = "module Tmp;" <> body <> "end;"
-- functionQ :: QuasiQuoter
-- functionQ = minijuvixQ (getInd . getStatement)
-- functionQ = juvixQ (getInd . getStatement)
-- where
-- getInd :: Statement -> FunctionDef
-- getInd = \case
@ -36,7 +36,7 @@ module MiniJuvix.Syntax.Abstract.Quasiquoter where
-- _ -> error "function definition not found"
-- inductiveQ :: QuasiQuoter
-- inductiveQ = minijuvixQ (getInd . getStatement)
-- inductiveQ = juvixQ (getInd . getStatement)
-- where
-- getInd :: Statement -> InductiveDef
-- getInd = \case
@ -44,7 +44,7 @@ module MiniJuvix.Syntax.Abstract.Quasiquoter where
-- _ -> error "inductive definition not found"
-- foreignQ :: QuasiQuoter
-- foreignQ = minijuvixQ (getForeign . getStatement)
-- foreignQ = juvixQ (getForeign . getStatement)
-- where
-- getForeign :: Statement -> ForeignBlock
-- getForeign = \case
@ -54,7 +54,7 @@ module MiniJuvix.Syntax.Abstract.Quasiquoter where
-- getStatement :: Module -> Statement
-- getStatement = (^?! moduleBody . moduleStatements . _nonEmpty . _Just . _head)
-- readAbsractModule :: String -> Text -> Either MiniJuvixError Module
-- readAbsractModule :: String -> Text -> Either JuvixError Module
-- readAbsractModule name body =
-- fmap (head . (^. resultModules))
-- . run
@ -73,9 +73,9 @@ module MiniJuvix.Syntax.Abstract.Quasiquoter where
-- _entryPointModulePaths = fakePath :| []
-- }
-- fakePath :: FilePath
-- fakePath = name <> ".mjuvix"
-- fakePath = name <> ".juvix"
-- minijuvixModule :: Lift a => (Module -> a) -> String -> String -> Q Exp
-- minijuvixModule proj modName str = case readAbsractModule modName (pack str) of
-- juvixModule :: Lift a => (Module -> a) -> String -> String -> Q Exp
-- juvixModule proj modName str = case readAbsractModule modName (pack str) of
-- Left e -> fail ("Error: " <> unpack (renderText e))
-- Right r -> TH.lift (proj r)

Some files were not shown because too many files have changed in this diff Show More