summary refs log tree commit diff stats
path: root/compiler/sem.nim
Commit message (Collapse)AuthorAgeFilesLines
* prevent eval crashes due to PContext-dependent ops not being available in ↵Zahary Karadjov2013-08-251-30/+35
| | | | evalConstExpr
* working code for simple cases of user-defined type classesZahary Karadjov2013-08-251-0/+6
|
* fixes #503Araq2013-07-021-9/+11
|
* astToStr is now immediateAraq2013-06-021-4/+11
|
* merged the persistent scopes work with the delayed proc compilation strategyZahary Karadjov2013-05-121-2/+1
|\
* | final fixes giving us a working compilerZahary Karadjov2013-05-121-2/+1
| |
* | get rid of TOverloadIter.stackPtrZahary Karadjov2013-05-121-0/+1
| |
* | get rid of ImportTablePos and ModuleTablePosZahary Karadjov2013-05-121-1/+1
| |
* | get rid of the SymTab* procs in astalgoZahary Karadjov2013-05-121-4/+4
| |
* | switch to a linked list of scopesZahary Karadjov2013-05-111-4/+4
|/
* fixes #117Araq2013-05-041-0/+4
|
* completed expr/stmt unificationAraq2013-05-031-2/+4
|
* revert new scope for 'if'Araq2013-05-021-1/+1
|
* first steps to the expr/stmt unificationAraq2013-04-301-1/+4
|
* first version of commonTypeAraq2013-04-221-0/+31
|
* fixes #287; bugfix: subrange checking is performed againAraq2013-04-121-1/+1
|
* fixes a long-standing bug about procvar checkingAraq2013-03-251-1/+1
|
* Removes executable bit for text files.Grzegorz Adam Hankiewicz2013-03-161-0/+0
|
* lazy operand sem'checking (beware)Araq2013-03-021-11/+5
|
* merged upstream masterZahary Karadjov2013-01-271-3/+5
|\
| * implemented generic multi methodsAraq2013-01-161-1/+2
| |
| * some fixes for generic first class iteratorsAraq2012-12-151-2/+1
| |
| * fixes #271Araq2012-12-151-0/+2
| |
* | remove any traces of the old global generics cacheZahary Karadjov2013-01-271-7/+7
| |
* | store the instantiation cache in the generic symbolZahary Karadjov2012-11-281-1/+1
| |
* | CaaS in-memory cachingZahary Karadjov2012-11-281-6/+5
| | | | | | | | | | removed some redundant filepath params and variables and switched to canonical paths in most places
* | caas is now drivable through stdinZahary Karadjov2012-11-281-7/+2
|/ | | | | * added idetools --eval * streams.readLine recognises and applies the backspace character
* AST quasi-quoting for macrosZahary Karadjov2012-11-111-0/+1
|
* next steps for exception trackingAraq2012-11-031-1/+1
|
* nimbuild should work againAraq2012-11-011-0/+1
|
* cas improvementsAraq2012-10-241-1/+2
|
* caas barely works nowAraq2012-10-241-3/+3
|
* syntax compatibility between do blocks and stmt blocksZahary Karadjov2012-10-041-5/+4
| | | | | | | | | | | | See the section `do notation` in the manual for more info. * nkMacroStmt has been removed Macro statements are now mapped to regular nkCall nodes. The support for additional clauses (such as else, except, of, etc) have been restored - they will now appear as additional arguments for the nkCall node (as nkElse, nkExcept, etc nodes) * fixed some regressions in the `is` operator and semCompiles
* experimental support for querying the type of expressions within macrosZahary Karadjov2012-10-031-0/+11
| | | | normalised the line endings of macros.nim (minor edits otherwise)
* fixes ttypeselectorsZahary Karadjov2012-09-281-1/+12
|
* proc bodies can be expressions with a typeAraq2012-09-221-0/+1
|
* fixes #194Araq2012-09-201-1/+3
|
* bugfix: 'nimrod i' works againAraq2012-09-181-1/+3
|
* some support for passing blocks to overloaded templates/macrosAraq2012-09-171-1/+2
|
* semExpr/semStmt mergedAraq2012-09-131-2/+9
|
* made more tests green; fixes #201Araq2012-09-121-13/+16
|
* term rewriting improvementsAraq2012-09-081-49/+2
|
* term rewriting macros fully implemented; still buggyAraq2012-09-031-9/+41
|
* next steps towards term rewriting macros; simple examples workAraq2012-08-301-1/+5
|
* first steps towards term rewriting macrosAraq2012-08-301-1/+14
|
* parameter passing works the same for macros and templates; use callsite ↵Araq2012-08-281-3/+3
| | | | magic to access the invokation AST
* implemented generic templatesAraq2012-08-271-3/+1
|
* next steps to hygienic templatesAraq2012-08-201-4/+2
|
* first steps to make templates hygienicAraq2012-08-201-2/+13
|
* bugfix: typo in actors.nimAraq2012-08-151-0/+1
|
> ^
6ff9ce26 ^
a6517ed8 ^
e5cbbea4 ^
e59a91b7 ^
6030d7e2 ^
e59a91b7 ^
6030d7e2 ^
e59a91b7 ^
6030d7e2 ^
e59a91b7 ^
6030d7e2 ^
6ff9ce26 ^
ee9a9237 ^
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

                                


                                                                             
 
                                   

                                                      

                  
      
 
       


                                                                                                                                                 
 




                                           
 





                                                                                                         
                 
                                
                                                                                                                                                                        
 
                                    
                   
                                
                                                                                                                                                                        
       



                                 
 
                            
                   
                                
                                                                                                                                                                        
       

                                 
 





                                                   
                   
                                
                                                                                                                                                                        
 
                                 
                   
                                
                                                                                                                                                                        
       



                                
 
                            
                   
                                
                                                                                                                                                                        
     

                                 
 



                                    
 
                      
              
                           
                                                                                                                                                                        
     

                                
 
       
 
       
               
  
               
  
               
         
                           
 
                            
# Example showing file syscalls.
#
# Create a file, open it for writing, write a character to it, close it, open
# it for reading, read a character from it, close it, delete it, and return
# the character read.
#
# To run (from the subx directory):
#   $ subx translate examples/ex7.subx -o examples/ex7
#   $ subx run examples/ex7
# Expected result:
#   $ echo $?
#   97

== code
#   instruction                     effective address                                                   register    displacement    immediate
# . op          subop               mod             rm32          base        index         scale       r32
# . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes

    # syscall(creat, Filename)
    bb/copy-to-EBX  Filename/imm32
    b9/copy-to-ECX  0x180/imm32/fixed-perms
    b8/copy-to-EAX  8/imm32/creat
    cd/syscall  0x80/imm8

    # stream = syscall(open, Filename, O_WRONLY, 0)  # we can't use 'fd' because it looks like a hex byte
    bb/copy-to-EBX  Filename/imm32
    b9/copy-to-ECX  1/imm32/wronly
    ba/copy-to-EDX  0x180/imm32/fixed-perms
    b8/copy-to-EAX  5/imm32/open
    cd/syscall  0x80/imm8
    # save stream
    bb/copy-to-EBX  Stream/imm32
    89/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to *EBX

    # syscall(write, Stream, "a", 1)
    # . load stream
    bb/copy-to-EBX  Stream/imm32
    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                 # copy *EBX to EBX
    # .
    b9/copy-to-ECX  A/imm32
    ba/copy-to-EDX  1/imm32/size
    b8/copy-to-EAX  4/imm32/write
    cd/syscall  0x80/imm8

    # syscall(close, Stream)
    # . load stream
    bb/copy-to-EBX  Stream/imm32
    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                 # copy *EBX to EBX
    # .
    b8/copy-to-EAX  6/imm32/close
    cd/syscall  0x80/imm8

    # stream = syscall(open, Filename, O_RDONLY, 0)
    bb/copy-to-EBX  Filename/imm32
    b9/copy-to-ECX  0/imm32/rdonly
    ba/copy-to-EDX  0x180/imm32/fixed-perms
    b8/copy-to-EAX  5/imm32/open
    cd/syscall  0x80/imm8
    # . save Stream
    bb/copy-to-EBX  Stream/imm32
    89/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to *EBX

    # syscall(read, Stream, B, 1)
    # . load stream
    bb/copy-to-EBX  Stream/imm32
    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                 # copy *EBX to EBX
    # .
    b9/copy-to-ECX  B/imm32
    ba/copy-to-EDX  1/imm32/size
    b8/copy-to-EAX  3/imm32/read
    cd/syscall  0x80/imm8

    # syscall(close, Stream)
    # . load stream
    bb/copy-to-EBX  Stream/imm32
    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                 # copy *EBX to EBX
    #
    b8/copy-to-EAX  6/imm32/close
    cd/syscall  0x80/imm8

    # syscall(unlink, filename)
    bb/copy-to-EBX  Filename/imm32
    b8/copy-to-EAX  0xa/imm32/unlink
    cd/syscall  0x80/imm8

    # syscall(exit, b)
    # . load b
    bb/copy-to-EBX  B/imm32
    8b/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           3/r32/EBX   .               .                 # copy *EBX to EBX
    #
    b8/copy-to-EAX  1/imm32/exit
    cd/syscall  0x80/imm8

== data

Stream:
    00 00 00 00
A:
    61 00 00 00
B:
    00 00 00 00
Filename:
    2e 66 6f 6f 00 00 00 00

# . . vim:nowrap:textwidth=0