Skip to content

Commit

Permalink
Merge pull request #31 from AxelHumeau/feature/compiler
Browse files Browse the repository at this point in the history
Feature/compiler
  • Loading branch information
AldricJourdain authored Jan 8, 2024
2 parents e528067 + 421592f commit 036dd9b
Show file tree
Hide file tree
Showing 7 changed files with 532 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ cabal.project.local~
.stack-work
glados
.vscode
output
4 changes: 4 additions & 0 deletions LobsterLang/LobsterLang.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ library
exposed-modules:
AST
AstEval
Compiler
Lib
Parse
Scope
Expand All @@ -42,6 +43,9 @@ library
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
build-depends:
base >=4.7 && <5
, bytestring
, utf8-string
, binary
default-language: Haskell2010

executable LobsterLang-exe
Expand Down
3 changes: 3 additions & 0 deletions LobsterLang/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import System.Exit (exitWith, ExitCode (ExitFailure))
import System.Environment (getArgs)
import Control.Exception
import SExpr (SExpr)
-- import Compiler

-- | Infinite loop until EOF from the user
inputLoop :: [Scope.ScopeMb] -> IO ()
Expand All @@ -35,6 +36,8 @@ compileFile :: String -> IO ()
compileFile s = case runParser parseLisp (0, 0) s of
Left err -> print err >> exitWith (ExitFailure 84)
Right (res, _, _) -> interpretateInfo res []
-- (Right (Just res), stack') -> let instructions = (astToInstructions (AST.Cond (Boolean True) (Value 1) (Just (AST.Call "CallHere" [(Value 0)])))) in showInstructions instructions >> writeCompiledInstructionsToFile "output" (compileInstructions instructions)


checkArgs :: [String] -> IO ()
checkArgs ("-i": _) = print "Launch Interpreter" >> inputLoop []
Expand Down
3 changes: 3 additions & 0 deletions LobsterLang/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ description: Please see the README on GitHub at <https://github.com/gith

dependencies:
- base >= 4.7 && < 5
- bytestring
- utf8-string
- binary

ghc-options:
- -Wall
Expand Down
Loading

0 comments on commit 036dd9b

Please sign in to comment.