diff --git a/compiler/ast.nim b/compiler/ast.nim index 89aba40c61..fd79c90e0e 100755 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -162,6 +162,7 @@ type nkImportStmt, # an import statement nkFromStmt, # a from * import statement nkIncludeStmt, # an include statement + nkBindStmt, # a bind statement nkCommentStmt, # a comment statement nkStmtListExpr, # a statement list followed by an expr; this is used # to allow powerful multi-line templates diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim index 17875d5242..b06194daf5 100755 --- a/compiler/astalgo.nim +++ b/compiler/astalgo.nim @@ -100,10 +100,12 @@ proc OpenScope*(tab: var TSymTab) proc RawCloseScope*(tab: var TSymTab) # the real "closeScope" adds some # checks in parsobj - # these are for debugging only: -proc debug*(n: PSym) -proc debug*(n: PType) -proc debug*(n: PNode) + +# these are for debugging only: They are not really deprecated, but I want +# the warning so that release versions do not contain debugging statements: +proc debug*(n: PSym) {.deprecated.} +proc debug*(n: PType) {.deprecated.} +proc debug*(n: PNode) {.deprecated.} # --------------------------- ident tables ---------------------------------- proc IdTableGet*(t: TIdTable, key: PIdObj): PObject diff --git a/compiler/evals.nim b/compiler/evals.nim index b1d3688c33..876f800d9e 100755 --- a/compiler/evals.nim +++ b/compiler/evals.nim @@ -822,7 +822,7 @@ proc evalTemplateArgs(n: PNode, s: PSym): PNode = addSon(result, arg) var evalTemplateCounter = 0 - # to prevend endless recursion in templates instantation + # to prevent endless recursion in templates instantation proc evalTemplate(n: PNode, sym: PSym): PNode = inc(evalTemplateCounter) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 8fa52b5d26..cf4d85dc81 100755 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -239,9 +239,9 @@ const asmStmtFrmt: "asm($1);$n", props: {hasSwitchRange, hasComputedGoto, hasCpp})] -var ccompiler*: TSystemCC = ccGcc +var ccompiler*: TSystemCC = ccGcc # the used compiler -const # the used compiler +const hExt* = "h" var cExt*: string = "c" # extension of generated C/C++ files diff --git a/compiler/parser.nim b/compiler/parser.nim index 544cbae876..d1798efa4f 100755 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -212,20 +212,20 @@ proc parseSymbol(p: var TParser): PNode = proc indexExpr(p: var TParser): PNode = result = parseExpr(p) -proc indexExprList(p: var TParser, first: PNode): PNode = - result = newNodeP(nkBracketExpr, p) +proc indexExprList(p: var TParser, first: PNode, k: TNodeKind, + endToken: TTokType): PNode = + result = newNodeP(k, p) addSon(result, first) getTok(p) optInd(p, result) - while (p.tok.tokType != tkBracketRi) and (p.tok.tokType != tkEof) and - (p.tok.tokType != tkSad): + while p.tok.tokType notin {endToken, tkEof, tkSad}: var a = indexExpr(p) addSon(result, a) if p.tok.tokType != tkComma: break getTok(p) optInd(p, a) optPar(p) - eat(p, tkBracketRi) + eat(p, endToken) proc exprColonEqExpr(p: var TParser, kind: TNodeKind, tok: TTokType): PNode = var a = parseExpr(p) @@ -460,13 +460,9 @@ proc primary(p: var TParser): PNode = addSon(result, parseSymbol(p)) result = parseGStrLit(p, result) of tkBracketLe: - result = indexExprList(p, result) + result = indexExprList(p, result, nkBracketExpr, tkBracketRi) of tkCurlyLe: - var a = result - result = newNodeP(nkCurlyExpr, p) - var b = setOrTableConstr(p) - result.add(a) - for i in 0 .. (a a*) + pkOption, ## a? + pkAndPredicate, ## &a + pkNotPredicate, ## !a + pkCapture, ## {a} + pkBackRef, ## $i + pkSearch, ## @a + pkCapturedSearch, ## {@} a + pkRule, ## a <- b + pkGrammar, ## list of rules + + Version 2 ========= diff --git a/web/news.txt b/web/news.txt index 2d6a0a5079..3588876f16 100755 --- a/web/news.txt +++ b/web/news.txt @@ -38,6 +38,7 @@ Changes affecting backwards compatibility - The ``pure`` pragma for procs has been renamed to ``noStackFrame``. - The threading API has been completely redesigned. - The ``unidecode`` module is now thread-safe and its interface has changed. +- The ``bind`` expression is deprecated, use a ``bind`` declaration instead. Language Additions @@ -55,6 +56,8 @@ Language Additions - There is a new user-definable syntactic construct ``a{i, ...}`` that has no semantics yet for built-in types and so can be overloaded to your heart's content. +- ``bind`` (used for symbol binding in templates and generics) is now a + declarative statement. Compiler Additions diff --git a/web/question.txt b/web/question.txt index 6f6730f948..10faf39bdc 100755 --- a/web/question.txt +++ b/web/question.txt @@ -31,6 +31,13 @@ You have to find out for yourself. If you don't find a tongue-in-cheek interpretation you will have to look harder. +Why yet another programming language? +------------------------------------- + +Nimrod is one of the very few *programmable* strongly typed languages, and +one of the even fewer that will produce native binaries that require no +runtime or interpreter. + How is Nimrod licensed? -----------------------