summary refs log tree commit diff stats
path: root/data
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2008-08-23 11:16:44 +0200
committerAndreas Rumpf <rumpf_a@web.de>2008-08-23 11:16:44 +0200
commit07d5a8085bbcc21a1d9d06a2976ecc00e9c8d55b (patch)
treeb07a53afeb56f4bba917c1a3a843f48dd25b62be /data
parent916c25f9a70b68eb7a5e2c45d7cc2e10c6e3a525 (diff)
downloadNim-07d5a8085bbcc21a1d9d06a2976ecc00e9c8d55b.tar.gz
too many changes to list
Diffstat (limited to 'data')
-rw-r--r--data/ast.yml87
-rw-r--r--data/basicopt.txt5
-rw-r--r--data/keywords.txt4
-rw-r--r--data/magic.yml54
-rw-r--r--data/messages.yml28
5 files changed, 125 insertions, 53 deletions
diff --git a/data/ast.yml b/data/ast.yml
index ee688909d..72a1b02b5 100644
--- a/data/ast.yml
+++ b/data/ast.yml
@@ -9,7 +9,7 @@
 
 {
 'SymFlag': [          # already 32 flags!
-  'sfGeneric',        # whether an operator, proc or type is generic
+  'sfTypeCheck',      # wether macro parameters should be type checked
   'sfForward',        # symbol is forward directed
   'sfImportc',        # symbol is external; imported
   'sfExportc',        # symbol is exported (under a specified name)
@@ -26,7 +26,7 @@
   'sfMainModule',     # module is the main module
   'sfSystemModule',   # module is the system module
   'sfNoReturn',       # proc never returns (an exit proc)
-  'sfReturnsNew',     # proc returns new allocated thing (allows optimizations)
+  'sfAddrTaken',      # the variable's address is taken (ex- or implicitely)
   'sfInInterface',    # symbol is in interface section declared
   'sfNoStatic',       # symbol is used within an iterator (needed for codegen)
                       # so it cannot be 'static' in the C code
@@ -56,32 +56,40 @@
                       # is used to speed up semantic checking a bit
   'tfEnumHasWholes',  # enum cannot be mapped into a range
   'tfVarargs',        # procedure has C styled varargs
-  'tfAssignable'      # can the type be assigned to?
+  'tfFinal'           # is the object final?
 ],
 
 'TypeKind': [        # order is important!
                      # Don't forget to change hti.nim if you make a change here
-   'tyNone', 'tyBool', 'tyChar',
-   'tyEmptySet', 'tyArrayConstr', 'tyNil', 'tyRecordConstr',
-   'tyGeneric',
-   'tyGenericInst', # instantiated generic type
-   'tyGenericParam',
-   'tyEnum', 'tyAnyEnum',
-   'tyArray',
-   'tyRecord',
-   'tyObject',
-   'tyTuple',
-   'tySet',
-   'tyRange',
-   'tyPtr', 'tyRef',
-   'tyVar',
-   'tySequence',
-   'tyProc',
-   'tyPointer', 'tyOpenArray',
-   'tyString', 'tyCString', 'tyForward',
-   # numerical types:
-   'tyInt', 'tyInt8', 'tyInt16', 'tyInt32', 'tyInt64', # signed integers
-   'tyFloat', 'tyFloat32', 'tyFloat64', 'tyFloat128'
+  'tyNone', 'tyBool', 'tyChar',
+  'tyEmptySet', 'tyArrayConstr', 'tyNil', 
+  'tyGeneric',
+  'tyGenericInst', # instantiated generic type
+  'tyGenericParam',
+  'tyEnum',
+  'tyAnyEnum',
+  'tyArray',
+  'tyObject',
+  'tyTuple',
+  'tySet',
+  'tyRange',
+  'tyPtr', 'tyRef',
+  'tyVar',
+  'tySequence',
+  'tyProc',
+  'tyPointer', 'tyOpenArray',
+  'tyString', 'tyCString', 'tyForward',
+  # numerical types:
+  'tyInt', 'tyInt8', 'tyInt16', 'tyInt32', 'tyInt64', # signed integers
+  'tyFloat', 'tyFloat32', 'tyFloat64', 'tyFloat128'
+],
+
+'NodeFlag': [ # keep this number under 16 for performance reasons!
+  'nfNone',
+  'nfBase2', # nfBase10 is default, so not needed
+  'nfBase8',
+  'nfBase16',
+  'nfAllConst' # used to mark complex expressions constant
 ],
 
 'NodeKind': [  # these are pure nodes
@@ -97,7 +105,6 @@
   'nkType',               # node is used for its typ field
 
   'nkCharLit',            # a character literal ''
-  'nkRCharLit',           # a raw character literal r''
 
   'nkIntLit',             # an integer literal
   'nkInt8Lit',
@@ -110,6 +117,8 @@
   'nkStrLit',             # a string literal ""
   'nkRStrLit',            # a raw string literal r""
   'nkTripleStrLit',       # a triple string literal """
+  'nkMetaNode',           # difficult to explan; represents itself
+                          # (used for macros)
   'nkNilLit',             # the nil literal
   # end of atoms
   'nkDotCall',            # used to temporarily flag a nkCall node; this is used
@@ -126,7 +135,7 @@
   'nkInfix',              # a call like (a + b)
   'nkPrefix',             # a call like !a
   'nkPostfix',            # something like a! (also used for visibility)
-  'nkPar',                # syntactic ()
+  'nkPar',                # syntactic (); may be a tuple constructor
   'nkCurly',              # syntactic {}
   'nkBracket',            # syntactic []
   'nkBracketExpr',        # an expression like a[i..j, k]
@@ -142,14 +151,7 @@
   'nkAccQuoted',          # `a` as a node
   'nkHeaderQuoted',       # `a(x: int)` as a node
 
-  'nkSetConstr',          # a set constructor {}
-  'nkConstSetConstr',     # a set constructor with only constant expressions
-  'nkArrayConstr',        # an array constructor []
-  'nkConstArrayConstr',   # an array constructor with only constant expressions
-  'nkRecordConstr',       # a record constructor []
-  'nkConstRecordConstr',  # a record constructor with only constant expressions
   'nkTableConstr',        # a table constructor {expr: expr}
-  'nkConstTableConstr',   # a table constructor with only constant expressions
   'nkQualified',          # describes a.b for qualified identifiers
   'nkHiddenStdConv',      # an implicit standard type conversion
   'nkHiddenSubConv',      # an implicit type conversion from a subtype
@@ -158,6 +160,16 @@
   'nkConv',               # a type conversion
   'nkCast',               # a type cast
   'nkAddr',               # a addr expression
+  'nkHiddenAddr',         # implicit address operator
+  'nkHiddenDeref',        # implicit ^ operator
+  'nkObjDownConv',        # down conversion between object types
+  'nkObjUpConv',          # up conversion between object types
+  'nkChckRangeF',         # range check for floats
+  'nkChckRange64',        # range check for 64 bit ints
+  'nkChckRange',          # range check for ints
+  'nkStringToCString',    # string to cstring
+  'nkCStringToString',    # cstring to string
+  'nkPassAsOpenArray',    # thing is passed as an open array
   # end of expressions
 
   'nkAsgn',               # a = b
@@ -198,8 +210,6 @@
   'nkBreakStmt',          # a break statement
   'nkContinueStmt',       # a continue statement
   'nkBlockStmt',          # a block statement
-  'nkGotoStmt',           # used by the transformation pass; first son is a sym
-                          # node containing a label
   'nkDiscardStmt',        # a discard statement
   'nkStmtList',           # a list of statements
   'nkImportStmt',         # an import statement
@@ -218,8 +228,8 @@
 
   # types as syntactic trees:
   'nkTypeOfExpr',
-  'nkRecordTy',
   'nkObjectTy',
+  'nkTupleTy',
   'nkRecList',            # list of record/object parts
   'nkRecCase',            # case section of record/object
   'nkRecWhen',            # when section of record/object
@@ -228,8 +238,9 @@
   'nkVarTy',
   'nkProcTy',
   'nkEnumTy',
-  'nkEnumFieldDef'        # `ident = expr` in an enumeration
-], 
+  'nkEnumFieldDef',       # `ident = expr` in an enumeration
+  'nkReturnToken',        # token used for interpretation
+],
 
 'SymKind': [
   # the different symbols (start with the prefix sk);
diff --git a/data/basicopt.txt b/data/basicopt.txt
index a6f6ffee5..dff49c3e8 100644
--- a/data/basicopt.txt
+++ b/data/basicopt.txt
@@ -4,7 +4,8 @@ Command::
   compile                   compile project with default code generator (C)
   compile_to_c              compile project with C code generator
   compile_to_cpp            compile project with C++ code generator
-  doc                       generate the documentation for inputfile; 
+  compile_to_ecmascript     compile project to ECMAScript code (experimental)
+  doc                       generate the documentation for inputfile;
                             with --run switch opens it with $BROWSER
 Arguments:
   arguments are passed to the program being run (if --run option is selected)
@@ -18,6 +19,8 @@ Options:
   --line_trace:on|off       code generation for line trace ON|OFF
   --debugger:on|off         turn Embedded Nimrod Debugger ON|OFF
   -x, --checks:on|off       code generation for all runtime checks ON|OFF
+  --obj_checks:on|off       code generation for obj conversion checks ON|OFF
+  --field_checks:on|off     code generation for case record fields ON|OFF
   --range_checks:on|off     code generation for range checks ON|OFF
   --bound_checks:on|off     code generation for bound checks ON|OFF
   --overflow_checks:on|off  code generation for over-/underflow checks ON|OFF
diff --git a/data/keywords.txt b/data/keywords.txt
index 4e5a1c8e6..5915bab05 100644
--- a/data/keywords.txt
+++ b/data/keywords.txt
@@ -10,9 +10,9 @@ macro method mod
 nil not notin
 object of or out
 proc ptr
-raise record ref return
+raise ref return
 shl shr
-template try type
+template try tuple type
 var
 when where while with without
 xor
diff --git a/data/magic.yml b/data/magic.yml
index a126b8075..519505eab 100644
--- a/data/magic.yml
+++ b/data/magic.yml
@@ -113,8 +113,13 @@
 'UnaryPlusF64',
 'UnaryMinusF64',
 'AbsF64',
-'Ze',
-'Ze64',
+'Ze8ToI',
+'Ze8ToI64',
+'Ze16ToI',
+'Ze16ToI64',
+'Ze32ToI64',
+'ZeIToI64',
+
 'ToU8',
 'ToU16',
 'ToU32',
@@ -123,6 +128,14 @@
 'ToInt',
 'ToBiggestInt',
 
+'CharToStr',
+'BoolToStr',
+'IntToStr',  # $ for ints
+'Int64ToStr',
+'FloatToStr',
+'CStrToStr',
+'StrToStr',
+
 # special ones:
 'And',
 'Or',
@@ -156,12 +169,12 @@
 'SetLengthSeq',
 'Assert',
 'Swap',
+'IsNil',
 
 # magic type constructors:
 'Array',
 'OpenArray',
 'Range',
-'Tuple',
 'Set',
 'Seq',
 
@@ -172,5 +185,38 @@
 'NimrodMajor',
 'NimrodMinor',
 'NimrodPatch',
-'CpuEndian'
+'CpuEndian',
+'NaN',
+'Inf',
+'NegInf',
+
+# magics for modifying the AST (macro support)
+'NLen',
+'NChild',
+'NSetChild',
+'NAdd',
+'NAddMultiple',
+'NDel',
+'NKind',
+'NIntVal',
+'NFloatVal',
+'NSymbol',
+'NIdent',
+'NGetType',
+'NStrVal',
+'NSetIntVal',
+'NSetFloatVal',
+'NSetSymbol',
+'NSetIdent',
+'NSetType',
+'NSetStrVal',
+'NNewNimNode',
+'NCopyNimNode',
+'NCopyNimTree',
+'StrToIdent',
+'IdentToStr',
+'EqIdent',
+'NHint',
+'NWarning',
+'NError'
 ]
diff --git a/data/messages.yml b/data/messages.yml
index e45c41754..8892b2c3f 100644
--- a/data/messages.yml
+++ b/data/messages.yml
@@ -23,7 +23,7 @@
 {'errInvalidToken': 'invalid token: $1'},
 {'errLineTooLong': 'line too long'},
 {'errInvalidNumber': '$1 is not a valid number'},
-{'errNumberOutOfRange': '$1 is too large or too small'},
+{'errNumberOutOfRange': 'number $1 out of valid range'},
 {'errNnotAllowedInCharacter': '\\n not allowed in character literal'},
 {'errClosingBracketExpected': "closing ']' expected, but end of file reached"},
 {'errMissingFinalQuote': "missing final '"},
@@ -32,10 +32,6 @@
 {'errTokenExpected': "'$1' expected"},
 {'errStringAfterIncludeExpected': "string after 'include' expected"},
 {'errRecursiveInclude': "recursive include file: '$1'"},
-{'errAtIfExpected': "'@if' expected"},
-{'errAtIfExpectedBeforeElse': "'@if' expected before '@else'"},
-{'errAtIfExpectedBeforeElif': "'@if' expected before '@elif'"},
-{'errAtEndExpected': "'@end' expected"},
 {'errOnOrOffExpected': "'on' or 'off' expected"},
 {'errNoneSpeedOrSizeExpected': "'none', 'speed' or 'size' expected"},
 {'errInvalidPragma': 'invalid pragma'},
@@ -157,13 +153,13 @@
 {'errSizeTooBig': "computing the type's size produced an overflow"},
 {'errSetTooBig': 'set is too large'},
 {'errBaseTypeMustBeOrdinal': 'base type of a set must be an ordinal'},
-{'errInheritanceOnlyWithObjects': 'inheritance only works with an object'},
+{'errInheritanceOnlyWithNonFinalObjects': 'inheritance only works non-final objects'},
 {'errInheritanceOnlyWithEnums': 'inheritance only works with an enum'},
 {'errIllegalRecursionInTypeX': "illegal recursion in type '$1'"},
 {'errCannotInstantiateX': "cannot instantiate: '$1'"},
-{'errExprHasNoAddress': 'expression has no address'},
+{'errExprHasNoAddress': "expression has no address"},
 {'errVarForOutParamNeeded':
-  'to an out parameter a variable needs to be passed'},
+  "for a 'var' type a variable needs to be passed"},
 {'errPureTypeMismatch': 'type mismatch'},
 {'errTypeMismatch': 'type mismatch: got ('},
 {'errButExpected': 'but expected one of: '},
@@ -243,6 +239,20 @@
 {'errWhitespaceExpected': "whitespace expected, got '$1'"},
 {'errXisNoValidIndexFile': "'$1' is no valid index file"},
 {'errCannotRenderX': "cannot render reStructuredText element '$1'"},
+{'errVarVarTypeNotAllowed': "type 'var var' is not allowed"},
+{'errIsExpectsTwoArguments': "'is' expects two arguments"},
+{'errIsExpectsObjectTypes': "'is' expects object types"},
+{'errXcanNeverBeOfThisSubtype': "'$1' can never be of this subtype"},
+{'errTooManyIterations': "interpretation requires too many iterations"},
+{'errCannotInterpretNodeX': "cannot interpret node kind '$1'"},
+{'errFieldXNotFound': "field '$1' cannot be found"},
+{'errInvalidConversionFromTypeX': "invalid conversion from type '$1'"},
+{'errAssertionFailed': "assertion failed"},
+{'errCannotGenerateCodeForX': "cannot generate code for '$1'"},
+{'errXNeedsReturnType': "converter needs return type"},
+{'errXRequiresOneArgument': "converter requires one parameter"},
+{'errUnhandledExceptionX': "unhandled exception: $1"},
+{'errCyclicTree': "macro returned a cyclic abstract syntax tree"},
 
 # user error message:
 {'errUser': '$1'},
@@ -276,6 +286,8 @@
 {'hintMo2FileInvalid': "mo2 file '$1' is invalid"},
 {'hintModuleHasChanged': "module '$1' has been changed"},
 {'hintCannotOpenMo2File': "mo2 file '$1' does not exist"},
+{'hintQuitCalled': "quit() called"},
+{'hintProcessing': "processing"},
 
 # user hint message:
 {'hintUser': '$1'}