Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
f550cd67
Commit
f550cd67
authored
Jul 16, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- more infrastructure
SVN=127430
parent
a703c9a9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
29 deletions
+28
-29
compilation.go
usr/gri/gosrc/compilation.go
+25
-2
globals.go
usr/gri/gosrc/globals.go
+1
-1
go.go
usr/gri/gosrc/go.go
+2
-26
No files found.
usr/gri/gosrc/compilation.go
View file @
f550cd67
...
@@ -7,6 +7,7 @@ package Compilation
...
@@ -7,6 +7,7 @@ package Compilation
import
Globals
"globals"
import
Globals
"globals"
import
Object
"object"
import
Object
"object"
import
Type
"type"
import
Type
"type"
import
Universe
"universe"
import
Package
"package"
import
Package
"package"
import
Scanner
"scanner"
import
Scanner
"scanner"
import
Parser
"parser"
import
Parser
"parser"
...
@@ -16,7 +17,8 @@ export Compilation
...
@@ -16,7 +17,8 @@ export Compilation
type
Compilation
struct
{
type
Compilation
struct
{
src_name
string
;
src_name
string
;
pkg
*
Globals
.
Object
;
pkg
*
Globals
.
Object
;
imports
*
Globals
.
List
;
// a list of *Globals.Package
imports
[
256
]
*
Package
.
Package
;
// TODO need open arrays
nimports
int
;
}
}
...
@@ -48,5 +50,26 @@ func (C *Compilation) Export() {
...
@@ -48,5 +50,26 @@ func (C *Compilation) Export() {
export
Compile
export
Compile
func
Compile
()
{
func
Compile
(
src_name
string
,
verbose
int
)
{
comp
:=
new
(
Compilation
);
comp
.
src_name
=
src_name
;
comp
.
pkg
=
nil
;
comp
.
nimports
=
0
;
src
,
ok
:=
sys
.
readfile
(
src_name
);
if
!
ok
{
print
"cannot open "
,
src_name
,
"
\n
"
return
;
}
Universe
.
Init
();
S
:=
new
(
Scanner
.
Scanner
);
S
.
Open
(
src_name
,
src
);
P
:=
new
(
Parser
.
Parser
);
P
.
Open
(
S
,
verbose
);
print
"parsing "
,
src_name
,
"
\n
"
;
P
.
ParseProgram
();
}
}
usr/gri/gosrc/globals.go
View file @
f550cd67
...
@@ -60,7 +60,7 @@ export Scope
...
@@ -60,7 +60,7 @@ export Scope
type
Scope
struct
{
type
Scope
struct
{
parent
*
Scope
;
parent
*
Scope
;
entries
*
List
;
entries
*
List
;
// entries *map[string] *Object; // doesn't work
yet
// entries *map[string] *Object; // doesn't work
properly
}
}
...
...
usr/gri/gosrc/go.go
View file @
f550cd67
...
@@ -5,12 +5,7 @@
...
@@ -5,12 +5,7 @@
package
main
package
main
import
Build
"build"
import
Build
"build"
import
Globals
"globals"
import
Compilation
"compilation"
import
Object
"object"
import
Type
"type"
import
Universe
"universe"
import
Scanner
"scanner"
import
Parser
"parser"
func
PrintHelp
()
{
func
PrintHelp
()
{
...
@@ -26,19 +21,6 @@ func PrintHelp() {
...
@@ -26,19 +21,6 @@ func PrintHelp() {
}
}
func
Compile
(
filename
,
src
string
,
verbose
int
)
{
Universe
.
Init
();
S
:=
new
(
Scanner
.
Scanner
);
S
.
Open
(
filename
,
src
);
P
:=
new
(
Parser
.
Parser
);
P
.
Open
(
S
,
verbose
);
P
.
ParseProgram
();
}
func
main
()
{
func
main
()
{
if
sys
.
argc
()
<=
1
{
if
sys
.
argc
()
<=
1
{
PrintHelp
();
PrintHelp
();
...
@@ -56,12 +38,6 @@ func main() {
...
@@ -56,12 +38,6 @@ func main() {
continue
;
continue
;
}
}
src
,
ok
:=
sys
.
readfile
(
sys
.
argv
(
i
));
Compilation
.
Compile
(
sys
.
argv
(
i
),
verbose
);
if
ok
{
print
"parsing "
+
sys
.
argv
(
i
)
+
"
\n
"
;
Compile
(
sys
.
argv
(
i
),
src
,
verbose
);
}
else
{
print
"error: cannot read "
+
sys
.
argv
(
i
)
+
"
\n
"
;
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment