summary refs log tree commit diff stats
path: root/compiler/pbraces.nim
blob: cf4dbffc5a6d6759935a5b2aa76410f4fef36409 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#
#
#           The Nim Compiler
#        (c) Copyright 2012 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

import 
  llstream, lexer, parser, idents, strutils, ast, msgs

proc parseAll*(p: var TParser): PNode = 
  result = nil

proc parseTopLevelStmt*(p: var TParser): PNode = 
  result = nil
an> quote do: proc x* = proc private {.exportc: `ic`.} = discard echo `ic` private() foo(c_func) x() template volatileLoad[T](x: ptr T): T = var res: T {.emit: [res, " = (*(", type(x[]), " volatile*)", x, ");"].} res template volatileStore[T](x: ptr T; y: T) = {.emit: ["*((", type(x[]), " volatile*)(", x, ")) = ", y, ";"].} proc main = var st: int var foo: ptr int = addr st volatileStore(foo, 12) echo volatileLoad(foo) main()