Implement single-valued, non-variadic function literals and
function calling. Implement a type compiler and named types.
Implement a universal scope containing built-in named types,
and some built-in constants. Implement a simple virtual
machine for executing statements and single-valued return.
Fix many places that incorrectly dealt with named types. In
particular, the Type.Zero methods now use the type's bit count
to determine the appropriate value representation. As a
result, a bit count of 0 now means architecture-dependent and
bounded types use unsafe.Sizeof to determine the correct
bounds. Previously, the bounds on a 32-bit machine would have
been wrong.
Eliminated Type.compatible, since the implementation is
equivalent for all types. Added Type.rep that shallowly
strips named types. Replaced almost all uses of Type.literal
with Type.rep.
Fix implementation of assign-op's so it only evaluates the
left side once. As part of this, there is now a generic way
to separate out the effect and value of an expression.
if there is a goroutine waiting to run
and the init goroutine enters a system call,
entersyscall was trying to kick off a new
scheduler for the other goroutine, causing
a panic (new goroutines can't run until main.main).
Rob Pike [Tue, 21 Jul 2009 22:10:47 +0000 (15:10 -0700)]
make 6l produce dynamically linked binaries (although they are fully statically linked as far
as go is concerned). the -d flag is now flipped; as on the mac, -d disables dynamic.
much remains to be improved to move the output closer to the gcc format.
Cleanup of Type/Value interface. Add Type.ZeroVal, replace
all type-specific value functions, and use ZeroVal to create
new frames. Remove Value.Type; it was unused and difficult
for values with composite types. Add Value.Assign methods.
Some cleanup. Elem() on PtrType is now just Elem and matches
with ArrayType. Generators now switch over the result type
instead of the operand type. Delete unused diag function.
Gather errors in a go.scanner.ErrorList instead of printing
them as we go.
Lots of bug fixes. Let the parser toss illegal character and
string literals. Compile unary + correctly. Allow float OP
ideal. Compile unary * correctly. Implement min and max float
values.
Produce friendlier errors messages for malformed character
literals and when the parser hits an unexpected EOF. Also,
disallow newlines in character literals.
another step toward eliminating forward declarations.
introduce NodeList* type in compiler to replace OLIST.
this clarifies where lists can and cannot occur.
list append and concatenation are now cheap.
the _r rules are gone from yacc.
rev and unrev are gone.
no more lists of lists.
the representation of assignments is a bit clunkier.
split into OAS (1=1) and OAS2 (2 or more on one side).
Robert Griesemer [Fri, 17 Jul 2009 00:11:18 +0000 (17:11 -0700)]
ast:
- renamed Program -> SourceFile
- added Package node representing the AST for an entire package
- added filter function to create a source file mimicking the
interface of an entire package
parser:
- parser entry to parse entire packages
- unified naming of parser entry points
- factored out entry points into new file (interface.go)
gofmt:
- extended to accept single .go files, and package paths:
gofmt file.go // formatting of a single file
gofmt -x file.go // interface of a single file
gofmt -x ./MyPackage // interface of a local package
gofmt -x math // interface of a $GOROOT relative package
Various adjustments in dependent files, documentation.
Fix handling of non-waitable zombie threads. Now they are not
considered running, so WaitStop doesn't lock up and
breakpoints get installed and uninstalled. We also don't try
to detach from them, since that will fail.
Make Value always represent an l-value and never a generic
container for values.
Instead of having one evaluator function that returns a
generic Value, there is now an evaluator function for each
generalized type that simply returns a native type.
The compiler is more type-safe now because there are almost no
type conversions at evaluation time and it's impossible to
invoke a nil evaluator function during evaluation. This also
makes ideals and pointers really clean.
As an added bonus, expression evaluation should be faster
because it doesn't require heap allocation for every
intermediate value, type switches, or lots of conversions to
and from Value. It also involves fewer function calls.
Rob Pike [Wed, 15 Jul 2009 23:10:17 +0000 (16:10 -0700)]
make the low-level encoder and decoder private and have them access byte.Buffers rather
than io.Readers and io.Writers.
change the Encoder/Decoder protocol so that each message is preceded by its length in bytes.
Beginnings of a Go interpreter. This implements basic and
pointer types, supports literals, identifiers, type-checking
most unary and binary operators, "compiling" a few unary and
binary operators, and assignment and declaration statements.
Rob Pike [Wed, 15 Jul 2009 18:47:29 +0000 (11:47 -0700)]
handle errors better:
1) terminate outstanding calls on the client when we see EOF from server
2) allow data to drain on server before closing the connection
1. use CONNECT instead of GET.
CONNECT has exactly the meaning
we want; most of the time people
connect to ip:port; we're connecting
to /_goRPC_
2. wait for a successful HTTP response
before assuming we are connected to
the RPC protocol. this allows better
error reporting and also keeps the
protocol alternating between speakers,
so that the buffering in the HTTP request
reader cannot accidentally eat some
RPC bytes too.
gotest sometimes hangs, but not in HTTP.
gotest -match=Unknown hangs every few runs
even in a clean client.
Robert Griesemer [Tue, 14 Jul 2009 17:44:57 +0000 (10:44 -0700)]
- added Filename field to token.Position
- handle //line filename:line comments in scanner
- moved error handling code used by various scanner clients
to errors.go
- added extra tests