Skip to content

Commit

Permalink
ast2 basics
Browse files Browse the repository at this point in the history
  • Loading branch information
nddrylliog committed Oct 1, 2010
1 parent 2311d69 commit 31165e5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/rock/frontend/AstBuilder2.ooc
@@ -0,0 +1,4 @@

// function defined in NagaQueen.leg
nq_parse: extern proto func (AstBuilder, CString) -> Int

18 changes: 18 additions & 0 deletions source/rock/middle/ast2/Import.ooc
@@ -0,0 +1,18 @@

import Node

/**
* Imports allow a module to use the functions, types, globals defined
* in another module.
*
* Imports are not transitive, ie. if `A` imports `B` and `B` imports `C`,
* `A` won't have access to C's symbols if it doesn't import it explicitly.
*/
Import: class extends Node {

importName: String
module: Module { get set }

init: func (=fullName) {}

}
28 changes: 28 additions & 0 deletions source/rock/middle/ast2/Module.ooc
@@ -0,0 +1,28 @@

import Node

/**
* A module contains types, functions, global variables.
*
* It has a name, a package, imports (ie. using another module's symbols)
* uses (for native libraries)
*/
Module: class extends Node {

/**
* The fullname is somemthing like: "my/package/MyModule".
* It doesn't contain ".ooc", and it's always '/', never '\' even
* on win32 platforms.
*/
fullName: String

/**
* List of functions in thie module that don't belong to any type
*/
functions := ArrayList<FuncDecl> new()

init: func (=fullName) {
}

}

0 comments on commit 31165e5

Please sign in to comment.