From: Mart Lubbers Date: Thu, 7 Apr 2016 10:27:43 +0000 (+0200) Subject: sem update' X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=c270b0fc79caa24c08c2d00c2e8205bbd47921ed;p=cc1516.git sem update' --- diff --git a/sem.dcl b/sem.dcl index 92f1d51..be207dd 100644 --- a/sem.dcl +++ b/sem.dcl @@ -3,5 +3,8 @@ definition module sem from Data.Either import :: Either from AST import :: AST from lex import :: Error +from parse import :: ParserOutput -semanticAnalysis :: AST -> Either String AST +:: SemOutput :== Either Error AST + +sem :: ParserOutput -> SemOutput diff --git a/sem.icl b/sem.icl index 2003038..1cb9e54 100644 --- a/sem.icl +++ b/sem.icl @@ -1,6 +1,26 @@ implementation module sem +from Data.Map import :: Map +import Data.Either +import Control.Monad.State import StdMisc -semanticAnalysis :: AST -> Either Error AST -semanticAnalysis a = +import AST +from parse import :: ParserOutput +from yard import :: Error + +:: Gamma :== Map String Type +:: Env a :== State Gamma a + +sem :: ParserOutput -> SemOutput +sem (Left p) = Left p +sem (Right (AST vd fd)) = undef +// foldM semVarDecl vd +// >>= \gamma ->foldM typecheck gamma fd + +semVarDecl :: Env VarDecl +semVarDecl = undef + + + + diff --git a/spl.icl b/spl.icl index 28b95fb..93374a5 100644 --- a/spl.icl +++ b/spl.icl @@ -16,6 +16,7 @@ from Text import class Text(concat), instance Text String import parse import lex +import sem import AST from yard import :: Error, instance toString Error @@ -60,10 +61,15 @@ Start w stdin <<< "//LEXER\n" <<< printTokens toks <<< "//LEXER\n" _ = stdin) # parseOut = parser lexOut - # stdin = if (not args.parse) stdin (case parser lexOut of + # stdin = if (not args.parse) stdin (case parseOut of (Right ast) = stdin <<< "//PARSER\n" <<< toString ast <<< "//PARSER\n" (Left parse) = stdin <<< toString parse) + # semOut = sem parseOut + # stdin = case semOut of + (Right ast) = + stdin <<< "//TYPE\n" <<< toString ast <<< "//TYPE\n" + (Left parse) = stdin <<< toString parse = snd $ fclose stdin w where printTokens :: [Token] -> String diff --git a/spl.prj b/spl.prj index a7a20dd..2539bb3 100644 --- a/spl.prj +++ b/spl.prj @@ -31,6 +31,7 @@ Global Link LinkMethod: Static GenerateRelocations: False + GenerateSymbolTable: False GenerateLinkMap: False LinkResources: False ResourceSource: @@ -97,6 +98,20 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: sem + Dir: {Project} + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: yard Dir: {Project} @@ -111,6 +126,20 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: _SystemDynamic + Dir: {Application}/lib/Dynamics + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: GenEq Dir: {Application}/lib/Generics @@ -349,6 +378,20 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: StdOverloadedList + Dir: {Application}/lib/StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: StdReal Dir: {Application}/lib/StdEnv @@ -363,6 +406,20 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: StdStrictLists + Dir: {Application}/lib/StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: StdString Dir: {Application}/lib/StdEnv @@ -419,6 +476,34 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: _SystemEnumStrict + Dir: {Application}/lib/StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: _SystemStrictLists + Dir: {Application}/lib/StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: StdMaybe Dir: {Application}/lib/StdLib @@ -461,6 +546,34 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: Control.Monad.State + Dir: {Application}/lib/clean-platform/OS-Independent + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: Control.Monad.Trans + Dir: {Application}/lib/clean-platform/OS-Independent + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: Data.Either Dir: {Application}/lib/clean-platform/OS-Independent @@ -475,6 +588,20 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: Data.Foldable + Dir: {Application}/lib/clean-platform/OS-Independent + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: Data.Func Dir: {Application}/lib/clean-platform/OS-Independent @@ -503,6 +630,20 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: Data.Functor.Identity + Dir: {Application}/lib/clean-platform/OS-Independent + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: Data.List Dir: {Application}/lib/clean-platform/OS-Independent @@ -517,6 +658,20 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: Data.Map + Dir: {Application}/lib/clean-platform/OS-Independent + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: Data.Maybe Dir: {Application}/lib/clean-platform/OS-Independent @@ -545,6 +700,34 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: Data.Set + Dir: {Application}/lib/clean-platform/OS-Independent + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: Data.Traversable + Dir: {Application}/lib/clean-platform/OS-Independent + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: Data.Void Dir: {Application}/lib/clean-platform/OS-Independent @@ -615,6 +798,34 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: Text.JSON + Dir: {Application}/lib/clean-platform/OS-Independent + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: Text.PPrint + Dir: {Application}/lib/clean-platform/OS-Independent + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: System.OS Dir: {Application}/lib/clean-platform/OS-Linux-64