Finish moving compiler.errors to basis

db4
Slava Pestov 2009-04-13 02:50:23 -05:00
parent d227fcd33f
commit e52be965f0
8 changed files with 46 additions and 50 deletions

View File

@ -4,7 +4,7 @@ USING: accessors init namespaces words words.symbol io
kernel.private math memory continuations kernel io.files kernel.private math memory continuations kernel io.files
io.pathnames io.backend system parser vocabs sequences io.pathnames io.backend system parser vocabs sequences
vocabs.loader combinators splitting source-files strings vocabs.loader combinators splitting source-files strings
definitions assocs compiler.errors compiler.units math.parser definitions assocs compiler.units math.parser
generic sets command-line ; generic sets command-line ;
IN: bootstrap.stage2 IN: bootstrap.stage2

View File

@ -2,4 +2,33 @@ IN: compiler.errors
USING: help.markup help.syntax vocabs.loader words io USING: help.markup help.syntax vocabs.loader words io
quotations words.symbol ; quotations words.symbol ;
ARTICLE: "compiler-errors" "Compiler warnings and errors"
"After loading a vocabulary, you might see messages like:"
{ $code
":errors - print 2 compiler errors"
":warnings - print 50 compiler warnings"
}
"These messages arise from the compiler's stack effect checker. Production code should not have any warnings and errors in it. Warning and error conditions are documented in " { $link "inference-errors" } "."
$nl
"Words to view warnings and errors:"
{ $subsection :warnings }
{ $subsection :errors }
{ $subsection :linkage }
"Compiler warnings and errors are also shown in the " { $link "ui.tools.error-list" } "." ;
HELP: compiler-error
{ $values { "error" "an error" } { "word" word } }
{ $description "Saves the error for future persual via " { $link :errors } ", " { $link :warnings } " and " { $link :linkage } "." } ;
HELP: :errors
{ $description "Prints all serious compiler errors from the most recent compile to " { $link output-stream } "." } ;
HELP: :warnings
{ $description "Prints all ignorable compiler warnings from the most recent compile to " { $link output-stream } "." } ;
HELP: :linkage
{ $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ;
{ :errors :warnings } related-words
ABOUT: "compiler-errors" ABOUT: "compiler-errors"

View File

@ -1,6 +1,7 @@
! Copyright (C) 2007, 2009 Slava Pestov. ! Copyright (C) 2007, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors source-files.errors kernel namespaces assocs ; USING: accessors source-files.errors kernel namespaces assocs
tools.errors ;
IN: compiler.errors IN: compiler.errors
TUPLE: compiler-error < source-file-error ; TUPLE: compiler-error < source-file-error ;
@ -48,3 +49,12 @@ T{ error-type
: compiler-error ( error word -- ) : compiler-error ( error word -- )
compiler-errors get-global pick compiler-errors get-global pick
[ [ [ <compiler-error> ] keep ] dip set-at ] [ delete-at drop ] if ; [ [ [ <compiler-error> ] keep ] dip set-at ] [ delete-at drop ] if ;
: compiler-errors. ( type -- )
errors-of-type values errors. ;
: :errors ( -- ) +compiler-error+ compiler-errors. ;
: :warnings ( -- ) +compiler-warning+ compiler-errors. ;
: :linkage ( -- ) +linkage-error+ compiler-errors. ;

View File

@ -8,7 +8,7 @@ classes.mixin classes.tuple continuations continuations.private
combinators generic.math classes.builtin classes compiler.units combinators generic.math classes.builtin classes compiler.units
generic.standard vocabs init kernel.private io.encodings generic.standard vocabs init kernel.private io.encodings
accessors math.order destructors source-files parser accessors math.order destructors source-files parser
classes.tuple.parser effects.parser lexer compiler.errors classes.tuple.parser effects.parser lexer
generic.parser strings.parser vocabs.loader vocabs.parser see generic.parser strings.parser vocabs.loader vocabs.parser see
source-files.errors ; source-files.errors ;
IN: debugger IN: debugger
@ -321,8 +321,6 @@ M: source-file-error error.
] bi format nl ] bi format nl
] [ error>> error. ] bi ; ] [ error>> error. ] bi ;
M: compiler-error summary asset>> summary ;
M: bad-effect summary M: bad-effect summary
drop "Bad stack effect declaration" ; drop "Bad stack effect declaration" ;

View File

@ -1,32 +1 @@
IN: tools.errors IN: tools.errors
USING: compiler.errors tools.errors help.markup help.syntax vocabs.loader
words quotations io ;
ARTICLE: "compiler-errors" "Compiler warnings and errors"
"After loading a vocabulary, you might see messages like:"
{ $code
":errors - print 2 compiler errors"
":warnings - print 50 compiler warnings"
}
"These messages arise from the compiler's stack effect checker. Production code should not have any warnings and errors in it. Warning and error conditions are documented in " { $link "inference-errors" } "."
$nl
"Words to view warnings and errors:"
{ $subsection :warnings }
{ $subsection :errors }
{ $subsection :linkage }
"Compiler warnings and errors are also shown in the " { $link "ui.tools.error-list" } "." ;
HELP: compiler-error
{ $values { "error" "an error" } { "word" word } }
{ $description "Saves the error for future persual via " { $link :errors } ", " { $link :warnings } " and " { $link :linkage } "." } ;
HELP: :errors
{ $description "Prints all serious compiler errors from the most recent compile to " { $link output-stream } "." } ;
HELP: :warnings
{ $description "Prints all ignorable compiler warnings from the most recent compile to " { $link output-stream } "." } ;
HELP: :linkage
{ $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ;
{ :errors :warnings } related-words

View File

@ -1,7 +1,6 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: assocs compiler.errors debugger io kernel sequences USING: assocs debugger io kernel sequences source-files.errors ;
source-files.errors ;
IN: tools.errors IN: tools.errors
#! Tools for source-files.errors. Used by tools.tests and others #! Tools for source-files.errors. Used by tools.tests and others
@ -14,12 +13,3 @@ IN: tools.errors
[ [ nl ] [ error. ] interleave ] [ [ nl ] [ error. ] interleave ]
bi* bi*
] assoc-each ; ] assoc-each ;
: compiler-errors. ( type -- )
errors-of-type values errors. ;
: :errors ( -- ) +compiler-error+ compiler-errors. ;
: :warnings ( -- ) +compiler-warning+ compiler-errors. ;
: :linkage ( -- ) +linkage-error+ compiler-errors. ;

View File

@ -3,7 +3,7 @@
USING: accessors arrays kernel continuations assocs namespaces USING: accessors arrays kernel continuations assocs namespaces
sequences words vocabs definitions hashtables init sets sequences words vocabs definitions hashtables init sets
math math.order classes classes.algebra classes.tuple math math.order classes classes.algebra classes.tuple
classes.tuple.private generic compiler.errors ; classes.tuple.private generic ;
IN: compiler.units IN: compiler.units
SYMBOL: old-definitions SYMBOL: old-definitions
@ -41,7 +41,7 @@ SYMBOL: compiler-impl
HOOK: recompile compiler-impl ( words -- alist ) HOOK: recompile compiler-impl ( words -- alist )
! Non-optimizing compiler ! Non-optimizing compiler
M: f recompile [ [ f swap compiler-error ] each ] [ [ f ] { } map>assoc ] bi ; M: f recompile [ f ] { } map>assoc ;
! Trivial compiler. We don't want to touch the code heap ! Trivial compiler. We don't want to touch the code heap
! during stage1 bootstrap, it would just waste time. ! during stage1 bootstrap, it would just waste time.

View File

@ -160,6 +160,7 @@ SYMBOL: interactive-vocabs
"assocs" "assocs"
"combinators" "combinators"
"compiler" "compiler"
"compiler.errors"
"compiler.units" "compiler.units"
"continuations" "continuations"
"debugger" "debugger"
@ -190,7 +191,6 @@ SYMBOL: interactive-vocabs
"tools.annotations" "tools.annotations"
"tools.crossref" "tools.crossref"
"tools.disassembler" "tools.disassembler"
"tools.errors"
"tools.memory" "tools.memory"
"tools.profiler" "tools.profiler"
"tools.test" "tools.test"