Commit Graph

55 Commits

Author SHA1 Message Date
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
Araq
05cffb9370 'is' operator for generic code 2011-07-31 00:55:30 +02:00
Araq
6a8a409f1b preparation for new 'is' operator; breaks bootstrapping again, sorry (use generated C code) 2011-07-31 00:21:32 +02:00
Araq
dce8949b9b bugfix: 'final' not passed to generic 2011-07-29 01:25:05 +02:00
Araq
2f066395ba bugfixes; step one for 'var T' as return type support 2011-07-28 00:53:52 +02:00
Araq
a6daf71520 old pointer deref operator completely removed 2011-07-23 20:19:05 +02:00
Araq
99bcc233cd bugfix: 'set' overloadable; further steps for multi threading support 2011-07-08 01:29:15 +02:00
Araq
db0a4a9f86 bugfix: shallowCopy should not break bootstrapping anymore; encodings.nim for windows improved 2011-06-21 01:52:42 +02:00
Araq
f1100356b1 zipfiles compiles again; added system.shallowCopy 2011-06-20 23:20:11 +02:00
Araq
ade67f1abc intsets are now a proper module and part of the stdlib 2011-06-14 01:36:49 +02:00
Araq
ca637c019c further improvements for thread analysis 2011-06-13 20:57:49 +02:00
Araq
9f9f0f0818 basic thread analysis working 2011-06-13 16:22:19 +02:00
Araq
c019d17561 first (non working) implementation of global thread analysis 2011-06-13 01:40:22 +02:00
Araq
3bc821aa5c basic generic collections implemented and tested 2011-06-07 03:37:36 +02:00
Araq
42eb21be7b bugfix: generic instantiation across module boundaries 2011-06-06 08:45:11 +02:00
Araq
958961bd8d overloading of [] for derefence operation should be possible now 2011-06-05 13:59:41 +02:00