Commit Graph

70 Commits

Author SHA1 Message Date
Zahary Karadjov
e43f8d842b merged branch overloading-for-macros 2012-03-19 12:06:38 +02:00
Zahary Karadjov
72f2a6e275 the test suite is mostly green again 2012-03-16 05:33:21 +02:00
Zahary Karadjov
6975ba401b fix for template redefinition. test cases added. 2012-03-15 14:15:37 +02:00
Araq
4da067691e implemented 'static'; macros do not work anymore 2012-03-15 00:28:28 +01:00
Zahary Karadjov
e5bd3b5b97 bootstraps fine with overloadable templates 2012-03-14 21:00:42 +02:00
Araq
c25ffbf262 first steps for cleaner static/const distinction 2012-03-13 02:01:56 +01:00
Araq
e88123fb17 fixes #100 2012-03-10 12:43:04 +01:00
Araq
4a9e07a47c ERecoverableError exception contains the error message 2012-02-25 12:57:16 +01:00
Zahary Karadjov
560a3bad28 `do' keyword in the grammar for lambda blocks 2012-02-10 14:50:35 +02:00
Araq
2c4a1dbc0c further steps for closure support 2012-02-08 09:10:59 +01:00
Araq
632aece191 further steps to closure support 2012-02-06 00:19:56 +01:00
Araq
e362cbbfd7 bugfix: tests/reject/tnoinst.nim is now rejected properly 2012-01-13 13:40:05 +01:00
Araq
e7e3c451ef removed '^ deprecated' message 2012-01-10 00:33:32 +01:00
Araq
2ae78c0cfb implicit invokation of items/pairs iterators 2012-01-08 01:29:10 +01:00
Araq
4f1b89c30c year 2012 for most copyright headers 2012-01-02 23:07:35 +01:00
Araq
af792da0bb codegen uses alias analysis to generate better code 2011-12-10 01:06:32 +01:00
Araq
2962ca7890 alias analysis as required for the code gen and the HLO 2011-12-08 23:21:08 +01:00
Araq
70cf34cbdc 'assert' is now implemented without compiler magic 2011-12-04 20:14:50 +01:00
Araq
7fcbdc6d42 implemented 'let' statement 2011-11-29 17:27:48 +01:00
Araq
72651de710 bugfix: 'when' sections in generic objects now work, so TThread[void] compiles 2011-11-20 16:13:03 +01:00
Zahary Karadjov
12bac28d23 macros and templates can be expanded anywhere where a type is expected.
This allows for various type selection algorithms to be implemented.
See tests / accept / compile / ttypeselectors.nim for examples.
2011-11-18 02:11:15 +02:00
Araq
bec06a0649 bugfix: s[1..n] = @[] produced wrong C code 2011-11-14 08:33:44 +01:00
Araq
77222b2aad fixes #59 2011-11-02 02:36:01 +01:00
Araq
351e89e705 better code generation for constant aggregates 2011-11-02 00:55:29 +01:00
Araq
78f37b2336 compilation cache: slurped files are a dependency too 2011-10-30 01:02:15 +02:00
Araq
90db9171a2 compilation cache: various bugfixes; works for the compiler itself 2011-10-27 00:41:42 +02:00
Araq
9fb36bd20c compilation cache: mostly working; generics not yet 2011-10-25 15:26:36 +02:00
Araq
51e01879ba 'bind' as a declarative statement 2011-10-10 02:04:15 +02:00
Araq
c138cc36b4 new syntactic construct: a{i} 2011-10-08 02:14:42 +02:00
Araq
e956abbadd slurp uses path; unidecode is improved and threadsafe 2011-10-08 01:17:06 +02:00
Zahary Karadjov
e3deb5b502 Cleaned up the circular dependecies and remaining issues
Changed: The []= operator for strings and sequences is now capable of splicing
2011-10-07 17:10:04 +03:00
Zahary Karadjov
eaeed1f846 getAst works correctly with existing AST values as template/macro arguments 2011-10-07 17:05:54 +03:00
Araq
42516c0086 code generator supports constant sequences; more consistent compile time evaluation 2011-10-07 09:02:08 +02:00
Araq
da6046dcba bugfix: overloading resolution for typeof 2011-09-27 00:27:51 +02:00
Araq
485c371942 renamed optional to discardable 2011-09-24 19:18:08 +02:00
Araq
72ceda98cb implemented optional pragma for implicit discard 2011-09-24 13:55:24 +02:00
Araq
033e3dfc50 l-values are preserved modulo type distinction 2011-09-24 13:15:11 +02:00
Araq
6023e994fb beginning of a taint mode; type system enhancements 2011-09-24 00:46:41 +02:00
Araq
2359b8b107 fixed some newly introduced bugs 2011-09-21 00:54:13 +02:00
Zahary Karadjov
9acfc43119 using statement (ala C#) implemented as macro (added as test).
simplified the usage of the interpolatedFragments iterator.
2011-09-20 14:13:45 +03:00
Zahary Karadjov
dbcca9b3b9 Moved the parseAST magics to evals.nim
Added string interpolation helper routines in parserutils

Added a proof-of-concept string interpolation user-land macros (currently, only as a test case):
  the interpolated expression could either be transformed to
  concat("literal string ", $(interpolated), " end") or
  "literal string $1 end" % [$(interpolated)]

Added a very initial definition of Optional[T] generic type

A new overload of ParseIdent was added in hope to get around the fact that the 
old one doesn't work correctly in macros, but the problem persists.
2011-09-20 14:13:45 +03:00
Zahary Karadjov
a28cf4e9cb Quick Fix:
Constant expressions used in when statements and tuple indexing are properly evaluated now

Even further step tested to be OK:

```nimrod
proc semConstExpr(c: PContext, n: PNode): PNode = 
  result = semAndEvalConstExpr(c, n)
```
2011-09-20 14:13:45 +03:00
Zahary Karadjov
91351e5996 Initial implementation of the parseExpr, parseStmt, getAst macro routines:
proc parseExpr*(s: string) : expr {.magic: "ParseExprToAst".}
  ## Compiles the passed string to its AST representation
  ## Expects a single expression

proc parseStmt*(s: string) : stmt {.magic: "ParseStmtToAst".}
  ## Compiles the passed string to its AST representation
  ## Expects one or more statements

proc getAst*(macroOrTemplate: expr): expr {.magic: "ExpandMacroToAst".}
  ## Obtains the AST nodes returned from a macro or template invocation
  ## example:
  ## macro FooMacro() = 
  ##   var ast = getAst(BarTemplate())

Handling of the node.toYaml magic moved to the evaluation engine.
2011-09-20 14:13:45 +03:00
Zahary Karadjov
d541815e4b Added AST introspection routines as a part of the standard library 2011-09-20 14:13:45 +03:00
Araq
fd62116f6e bugfixes for generics; new threads implementation still broken 2011-09-20 00:56:48 +02:00
Araq
b0742c5b27 finally got rid of nkPassAsOpenArray 2011-08-16 08:56:53 +02:00
Araq
72e7a98543 added system.slurp for easy embedding of resources 2011-08-10 00:43:58 +02:00
Araq
5131b3cea4 support for C++ code generation; importcpp and importobjc pragmas 2011-08-07 21:02:09 +02:00
Araq
3e806a374a 'var T' for iterators 2011-07-31 22:39:17 +02:00
Araq
00da785f5d void type for generics 2011-07-31 01:11:34 +02:00