summary refs log tree commit diff stats
path: root/todo.txt
blob: 08b1865b193b28bf5d3d7d75163454d5145f3623 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
- built-in serialization
- thread support: threadvar on Windows seems broken; 
  add --deadlock_prevention:on|off switch

- ban ``nil`` from the AST. This might also fix bugs concerning macros.

- we need a way to disable tests
- deprecate ^ and make it available as operator
- test branch coverage
- checked exceptions
- do not ambiguity error for methods if ambiguity only affects the same 
  dispatcher anyway
- slicing


High priority (version 0.9.0)
=============================


- fix implicit generic routines
- fix the streams implementation so that it uses methods
- fix overloading resolution
- wrong co-/contravariance


Bugs
----
- proc (x: int) is passable to proc (x: var int)  !?
- detected by pegs module 64bit: p(result, result) should use a temporary!
- the parser allows empty object case branches
- Exception matching needs to take subclasses into account


To implement
------------

* sort routine
* hash tables and sets
* distinct types for array/seq indexes
* constant sequences

* implement closures for the C code generator



Low priority
------------
- resizing of strings/sequences could take into account the memory that
  is allocated
- implicit conversions from ``ptr/ref T`` to ``var T`` (from
  ``ptr/ref T`` to ``T``)?
- documentation: type converters
- typeAllowed() for parameters...
- find a way to reintroduce the cleanup() pass for C code generation: this
  is hard because of partial evaluation --> symbol files will fix this as
  a side effect
- implement better error handling: errornous top level statements are ignored
  and not part of the symbal table --> for REPL
  --> this needs deletion operation for symbol table!
- floating point checks for EcmaScript
- enhance `` notation for identifier concatenation: `concat` a `these`
- prefer proc in current module over other procs with same overloading result?
- real types for template results
- generalized case statement (requires better transf)
- normalize for the DOM
- tlastmod returns wrong results on BSD (Linux, MacOS X: works)
- nested tuple unpacking
- fast assignment optimization for TPeg


Library
-------

- locale support
- conversion between character sets
- bignums
- ftp (and other internet protocols)

- pdcurses bindings
- queues additional to streams: have two positions (read/write) instead of one

- for system:
  proc `@` [T](a: openArray[T]): seq[T] = 
    newSeq(result, a.len)
    for i in 0..a.len-1: result[i] = a[i]
    
  --> ensure @[] calls the array version!


Version 2
---------

- language change: inheritance should only work with reference types, so that
  the ``type`` field is not needed for objects! --> zero overhead aggregation
  BETTER: ``is`` and safe object conversions only work with ref objects. Same
  for multi methods.
  
- explicit nil types?
  * nil seq[int]
  * nil string
  * nil ref int
  * nil ptr THallo
  * nil proc 

- better for backwards compatibility: default nilable, but ``not nil``
  notation:
  
  type
    PWindow = ref TWindow not nil
- the two other parsers


Low priority
------------

- ``when T is int`` for generic code
- ``when validCode( proc ()  )`` for generic code
- macros: ``typecheck`` pragma; this allows transformations based on types!
- find a way for easy constructors and destructors; (destructors are much more
  important than constructors)
- code generated for type information is wasteful


Other ideas
-----------
- startsWith `=^`
- endsWith `=$`
- ignore case `=?` --> `=$?` too?


RST
---
- footnotes; prefix :i: whitespace before :i:, _reference, `reference`__
  __ anonymous: www.nimrod.org
- rewrite the parser to use the new better look ahead technique that c2nim
  uses
f='/ahoang/Nim/blame/doc/grammar.txt?h=devel&id=972c51086152bd45aef4eb17c099fa3472a19d04'>^
439aa2d04 ^

8b2a9401a ^
053309e60 ^






8b2a9401a ^
053309e60 ^

8b2a9401a ^
439aa2d04 ^
8b2a9401a ^
053309e60 ^

8b2a9401a ^
439aa2d04 ^



8b2a9401a ^

053309e60 ^









8b2a9401a ^
053309e60 ^


8b2a9401a ^
439aa2d04 ^


8b2a9401a ^

439aa2d04 ^













e792940f5 ^
439aa2d04 ^








ddaedab83 ^
439aa2d04 ^


8b2a9401a ^
10ab814fb ^
8b2a9401a ^
66a7e3d37 ^
10ab814fb ^
8b2a9401a ^
66a7e3d37 ^
10ab814fb ^
8b2a9401a ^
053309e60 ^






8b2a9401a ^
439aa2d04 ^
8b2a9401a ^
439aa2d04 ^
8b2a9401a ^
439aa2d04 ^
053309e60 ^
8b2a9401a ^
439aa2d04 ^
053309e60 ^

8b2a9401a ^
439aa2d04 ^





8b2a9401a ^
439aa2d04 ^

10ab814fb ^
8b2a9401a ^
439aa2d04 ^

90119066a ^
8b2a9401a ^

439aa2d04 ^
8b2a9401a ^
439aa2d04 ^
8b2a9401a ^
439aa2d04 ^





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

                                  
                             


                                                               
 
                                                            

                          
                        
 







                                                                               
 
                                                       
 

                                                                             
                                                    

                                                  
                


                                                  

                                                                              




                                                                       



                                                                  
                    


                       


                                               
 

                                                        
 

                                                        
 

                                                        
 






                                                                        
 

                                            
 
                                      
 

                                    
 



                                                         

                         









                           
                                                                 


                                                                               
 


                                                     

                                     













                                                                           
                                                








                                                                       
                                                        


                                                            
 
                                                               
 
                                                                     
                                                                    
 
                                                 
                                                                   
 






                                                                         
 
                                          
 
                                                                          
                     
                                                                      
                                                                
 
                                     

                                                                 
 





                                                            
 

                                                                
                                                          
 

                                                          
                                                               

                    
                                                                               
 
                                                                  
 





                                                                        
module ::= ([COMMENT] [SAD] stmt)*

comma ::= ',' [COMMENT] [IND]
operator ::= OP0 | OR | XOR | AND | OP3 | OP4 | OP5 | OP6 | OP7
           | 'is' | 'isnot' | 'in' | 'notin'
           | 'div' | 'mod' | 'shl' | 'shr' | 'not'

prefixOperator ::= OP0 | OP3 | OP4 | OP5 | OP6 | OP7 | 'not'

optInd ::= [COMMENT] [IND]
optPar ::= [IND] | [SAD]

lowestExpr ::= orExpr (OP0 optInd orExpr)*
orExpr ::= andExpr (OR | 'xor' optInd andExpr)*
andExpr ::= cmpExpr ('and' optInd cmpExpr)*
cmpExpr ::= ampExpr (OP3 | 'is' | 'isnot' | 'in' | 'notin' optInd ampExpr)*
ampExpr ::= plusExpr (OP4 optInd plusExpr)*
plusExpr ::= mulExpr (OP5 optInd mulExpr)*
mulExpr ::= dollarExpr (OP6 | 'div' | 'mod' | 'shl' | 'shr' optInd dollarExpr)*
dollarExpr ::= primary (OP7 optInd primary)*

indexExpr ::= '..' [expr] | expr ['=' expr | '..' expr]

castExpr ::= 'cast' '[' optInd typeDesc optPar ']' '(' optInd expr optPar ')'
addrExpr ::= 'addr' '(' optInd expr optPar ')'
symbol ::= '`' (KEYWORD | IDENT | operator | '(' ')'
               | '[' (',' | ['$'] '..' ['$'])* ']'
               | '=' | literal)+ '`'
         | IDENT
         
primaryPrefix ::= (prefixOperator | 'bind') optInd
primarySuffix ::= '.' optInd symbol
                | '(' optInd namedExprList optPar ')'
                | '[' optInd [indexExpr (comma indexExpr)* [comma]] optPar ']'
                | '^'
                | pragma

primary ::= primaryPrefix* (symbol | constructor | castExpr | addrExpr)
            primarySuffix*

literal ::= INT_LIT | INT8_LIT | INT16_LIT | INT32_LIT | INT64_LIT
          | FLOAT_LIT | FLOAT32_LIT | FLOAT64_LIT
          | STR_LIT | RSTR_LIT | TRIPLESTR_LIT
          | CHAR_LIT
          | NIL

constructor ::= literal
          | '[' optInd colonExprList optPar ']'
          | '{' optInd sliceExprList optPar '}'
          | '(' optInd colonExprList optPar ')'

colonExpr ::= expr [':' expr]
colonExprList ::= [colonExpr (comma colonExpr)* [comma]]

namedExpr ::= expr ['=' expr]
namedExprList ::= [namedExpr (comma namedExpr)* [comma]]

sliceExpr ::= expr ['..' expr]
sliceExprList ::= [sliceExpr (comma sliceExpr)* [comma]]

exprOrType ::= lowestExpr
            | 'if' expr ':' expr ('elif' expr ':' expr)* 'else' ':' expr
            | 'var' exprOrType
            | 'ref' exprOrType
            | 'ptr' exprOrType
            | 'type' exprOrType
            | 'tuple' tupleDesc

expr ::= exprOrType
     | 'proc' paramList [pragma] ['=' stmt] 

qualifiedIdent ::= symbol ['.' symbol]

typeDesc ::= exprOrType
         | 'proc' paramList [pragma]

macroStmt ::= ':' [stmt] ('of' [sliceExprList] ':' stmt
                         |'elif' expr ':' stmt
                         |'except' exceptList ':' stmt )*
                         ['else' ':' stmt]

simpleStmt ::= returnStmt
             | yieldStmt
             | discardStmt
             | raiseStmt
             | breakStmt
             | continueStmt
             | pragma
             | importStmt
             | fromStmt
             | includeStmt
             | exprStmt
complexStmt ::= ifStmt | whileStmt | caseStmt | tryStmt | forStmt
              | blockStmt | asmStmt
              | procDecl | iteratorDecl | macroDecl | templateDecl | methodDecl
              | constSection | typeSection | whenStmt | varSection

indPush ::= IND # and push indentation onto the stack
indPop ::= # pop indentation from the stack

stmt ::= simpleStmt [SAD]
 | indPush (complexStmt | simpleStmt)
  ([SAD] (complexStmt | simpleStmt))*
   DED indPop

exprStmt ::= lowestExpr ['=' expr | [expr (comma expr)*] [macroStmt]]
returnStmt ::= 'return' [expr]
yieldStmt ::= 'yield' expr
discardStmt ::= 'discard' expr
raiseStmt ::= 'raise' [expr]
breakStmt ::= 'break' [symbol]
continueStmt ::= 'continue'
ifStmt ::= 'if' expr ':' stmt ('elif' expr ':' stmt)* ['else' ':' stmt]
whenStmt ::= 'when' expr ':' stmt ('elif' expr ':' stmt)* ['else' ':' stmt]
caseStmt ::= 'case' expr [':'] ('of' sliceExprList ':' stmt)*
                               ('elif' expr ':' stmt)*
                               ['else' ':' stmt]
whileStmt ::= 'while' expr ':' stmt
forStmt ::= 'for' symbol (comma symbol)* 'in' expr ['..' expr] ':' stmt
exceptList ::= [qualifiedIdent (comma qualifiedIdent)*]

tryStmt ::= 'try' ':' stmt
           ('except' exceptList ':' stmt)*
           ['finally' ':' stmt]
asmStmt ::= 'asm' [pragma] (STR_LIT | RSTR_LIT | TRIPLESTR_LIT)
blockStmt ::= 'block' [symbol] ':' stmt
filename ::= symbol | STR_LIT | RSTR_LIT | TRIPLESTR_LIT
importStmt ::= 'import' filename (comma filename)*
includeStmt ::= 'include' filename (comma filename)*
fromStmt ::= 'from' filename 'import' symbol (comma symbol)*

pragma ::= '{.' optInd (colonExpr [comma])* optPar ('.}' | '}')

param ::= symbol (comma symbol)* (':' typeDesc ['=' expr] | '=' expr)
paramList ::= ['(' [param (comma param)*] optPar ')'] [':' typeDesc]

genericParam ::= symbol [':' typeDesc] ['=' expr]
genericParams ::= '[' genericParam (comma genericParam)* optPar ']'


routineDecl := symbol ['*'] [genericParams] paramList [pragma] ['=' stmt]
procDecl ::= 'proc' routineDecl
macroDecl ::= 'macro' routineDecl
iteratorDecl ::= 'iterator' routineDecl
templateDecl ::= 'template' routineDecl
methodDecl ::= 'method' routineDecl

colonAndEquals ::= [':' typeDesc] '=' expr

constDecl ::= symbol ['*'] [pragma] colonAndEquals [COMMENT | IND COMMENT]
            | COMMENT
constSection ::= 'const' indPush constDecl (SAD constDecl)* DED indPop
typeDef ::= typeDesc | objectDef | enumDef | 'distinct' typeDesc

objectField ::= symbol ['*'] [pragma]
objectIdentPart ::= objectField (comma objectField)* ':' typeDesc
                    [COMMENT|IND COMMENT]

objectWhen ::= 'when' expr ':' [COMMENT] objectPart
              ('elif' expr ':' [COMMENT] objectPart)*
              ['else' ':' [COMMENT] objectPart]
objectCase ::= 'case' expr ':' typeDesc [COMMENT]
              ('of' sliceExprList ':' [COMMENT] objectPart)*
              ['else' ':' [COMMENT] objectPart]

objectPart ::= objectWhen | objectCase | objectIdentPart | 'nil'
             | indPush objectPart (SAD objectPart)* DED indPop
tupleDesc ::= '[' optInd [param (comma param)*] optPar ']'

objectDef ::= 'object' [pragma] ['of' typeDesc] objectPart
enumField ::= symbol ['=' expr]
enumDef ::= 'enum' (enumField [comma] [COMMENT | IND COMMENT])+

typeDecl ::= COMMENT
           | symbol ['*'] [genericParams] ['=' typeDef] [COMMENT | IND COMMENT]

typeSection ::= 'type' indPush typeDecl (SAD typeDecl)* DED indPop

colonOrEquals ::= ':' typeDesc ['=' expr] | '=' expr
varField ::= symbol ['*'] [pragma]
varPart ::= symbol (comma symbol)* colonOrEquals [COMMENT | IND COMMENT]
varSection ::= 'var' (varPart
                   | indPush (COMMENT|varPart)
                     (SAD (COMMENT|varPart))* DED indPop)