1
0
mirror of https://github.com/golang/go synced 2024-10-04 13:21:22 -06:00
Commit Graph

117 Commits

Author SHA1 Message Date
Ken Thompson
1ea5bc7533 stack allocation for the init function
R=r
OCL=17063
CL=17063
2008-10-13 20:14:09 -07:00
Russ Cox
5f1202428b add empty var ( ), type ( ), const ( ) factorings
suggested by rob (could make programs generating
go easier to write).

R=ken
DELTA=13  (13 added, 0 deleted, 0 changed)
OCL=16766
CL=16766
2008-10-08 15:33:09 -07:00
Russ Cox
02d184b303 remove support for *T as an implicit declaration of T
R=ken
OCL=16651
CL=16653
2008-10-07 13:00:10 -07:00
Russ Cox
d364d28142 implement new semicolon rules:
*  1. all statements and declarations are terminated by semicolons
 *  2. semicolons can be omitted at top level.
 *  3. semicolons can be omitted before and after the closing ) or }
 *	on a list of statements or declarations.

now that semicolons are in, uncomment forward declaration
	of interfaces

R=ken
DELTA=285  (124 added, 114 deleted, 47 changed)
OCL=16638
CL=16646
2008-10-07 12:36:30 -07:00
Russ Cox
74e2e087e2 change type names to go live at the name, so that
type T struct {
		next *T
	}

and

	type T *struct {
		next T
	}

are valid without needing forward declarations.

add "type T struct" syntax for forward struct declarations.

add "type T interface" syntax, but commented out
	(need to fix semicolons first)

R=ken
DELTA=452  (259 added, 115 deleted, 78 changed)
OCL=16580
CL=16584
2008-10-06 16:44:17 -07:00
Russ Cox
2e1bb4a4cf add method test & fix method name bugs
R=ken,r
DELTA=86  (72 added, 9 deleted, 5 changed)
OCL=16488
CL=16488
2008-10-04 02:51:03 -07:00
Russ Cox
b8babed7c2 new import/export format
package flag
	export type flag.Flag struct { name flag.string; usage flag.string; \
		value flag.Value; next *flag.Flag }
	type flag.string string
	type flag.Value interface { AsBool () (? *flag.BoolValue); \
		AsInt () (? *flag.IntValue); AsString () (? *flag.StringValue); \
		IsBool () (? flag.bool); IsInt () (? flag.bool); IsString () (? flag.bool); \
		Str () (? flag.string); ValidValue (str flag.string) (? flag.bool) }
	type flag.BoolValue struct { val flag.bool; p *flag.bool }
	type flag.IntValue struct { val flag.int64; p *flag.int64 }
	type flag.StringValue struct { val flag.string; p *flag.string }
	type flag.bool bool
	func (e *flag.StringValue) AsBool () (? *flag.BoolValue)
	func (e *flag.StringValue) AsInt () (? *flag.IntValue)
	...

the \ continuations are for this message, not real.

changed delimiter for import from (( )) to $$ $$.

replaced mksys.bash with mksys.c

changed sys.go to use leading export,
	fake package name is now SYS not foop

don't always require ; on forward func decls

R=ken,r
DELTA=1827  (446 added, 1083 deleted, 298 changed)
OCL=16433
CL=16463
2008-10-03 16:15:55 -07:00
Ken Thompson
f21e731c71 added printn and panicn
prints that insert spaces and new line

R=r
OCL=16370
CL=16370
2008-10-02 14:38:07 -07:00
Russ Cox
4d571c9093 fix up arg list parsing to handle any names:
type t1 int;
type t2 int;
type t3 int;
func f1(t1, t2, t3);
func f2(t1, t2, t3 bool);
func f3(t1, t2, x t3);
func f4(*t2, x t3);	// error: cannot mix
func f5(t1, *t3);
func (x *t1) f6(y *[]t2) (t1, *t3);
func f7() (int, *string);
func f8(t1, *t2, x t3);	// error: cannot mix
func f9() (x int, *string);
func f10(*t2, t3);

R=ken
OCL=16202
CL=16210
2008-09-30 12:53:11 -07:00
Ken Thompson
b6f59358b5 minor bugs
R=r
OCL=16163
CL=16163
2008-09-29 20:33:51 -07:00
Ken Thompson
89ac5618ac toward methods on any type
R=r
OCL=16068
CL=16068
2008-09-28 20:22:31 -07:00
Ken Thompson
9f3d600be6 export
syntax for inheritance

R=r
OCL=16028
CL=16028
2008-09-26 21:27:26 -07:00
Russ Cox
c3d841f5d4 handle negative numeric constants in import.
(fixes bugs/bug106)

package bug0
export const A = -1

package bug1
import "bug0"

R=ken
DELTA=21  (19 added, 0 deleted, 2 changed)
OCL=15901
CL=15968
2008-09-26 11:44:20 -07:00
Ken Thompson
5f0a5e7a13 more export
R=r
OCL=15771
CL=15771
2008-09-24 14:12:21 -07:00
Russ Cox
fb2c66710c compiler changes:
export.c:
		- only expose explicitly exported types to importer
		- fix behind your back
	go.h:
		- add deep() prototype (fixes 64-bit linux crash on time.go)
	go.y:
		- add a new syntax error case
	walk.c:
		- allow a,b = f() where f is func ptr (fixes bug088)

R=ken
OCL=15617
CL=15630
2008-09-22 12:45:01 -07:00
Russ Cox
13f3149a01 more helpful messages for name-related syntax errors.
R=ken
OCL=15477
CL=15479
2008-09-18 13:32:14 -07:00
Russ Cox
f0635bbfaa Linux bison rejects // comments outside { code snippets }
R=ken
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=15444
CL=15446
2008-09-17 14:09:44 -07:00
Ken Thompson
304440356d assignment in select
with new select operator

R=r
OCL=15418
CL=15418
2008-09-16 20:51:50 -07:00
Rob Pike
47919799b4 new grammar:
binary <- is send
	unary <- is recv
	-< is gone
	case a := <-ch: works in select
	case a = <-ch: works in select
support for new cases is not yet in the compiler but all non-select
code works

second CL will update affected go source

R=ken
OCL=15414
CL=15414
2008-09-16 19:14:33 -07:00
Ken Thompson
d01a1ec260 robs wednesday bug
R=r
OCL=15327
CL=15327
2008-09-14 17:29:50 -07:00
Ken Thompson
2119294af9 methods on any type
-- but only *struct tested

R=r
OCL=15326
CL=15326
2008-09-14 16:57:55 -07:00
Ken Thompson
1ae08bee90 Automated g4 rollback of changelist 15312.
*** Reason for rollback ***

  <enter reason for rollback>

*** Original change description ***

correct signal name thru package rename

R=r
OCL=15313
CL=15313
2008-09-13 14:49:36 -07:00
Ken Thompson
28b9702741 correct signal name thru package rename
R=r
OCL=15312
CL=15312
2008-09-13 14:46:19 -07:00
Ken Thompson
d40f032d18 fixed bug in certain
evaluation of complex literals

R=r
OCL=15036
CL=15036
2008-09-09 15:47:31 -07:00
Ken Thompson
0194aaf918 T{} syntax for constructors
T(expression) for conversion
FUNC keyword no longer a type

R=r
OCL=14887
CL=14887
2008-09-05 19:50:34 -07:00
Ken Thompson
193eac7917 bugs 29, 61, 62, 74
fixedbugs 49 now (correctly) fails
bugs 32, 41, 68, 77 shouldnt be bugs

R=r
OCL=14842
CL=14842
2008-09-04 17:15:15 -07:00
Ken Thompson
9dbaab54d1 rewriting bugs
R=r
OCL=14810
CL=14810
2008-09-04 12:21:10 -07:00
Ken Thompson
182f91ffe0 map literals
R=r
OCL=14759
CL=14759
2008-09-03 14:40:22 -07:00
Ken Thompson
4539ced714 array literals
R=r
OCL=14756
CL=14756
2008-09-03 14:09:29 -07:00
Ken Thompson
a7f1af81bd minor bugs
R=r
OCL=14702
CL=14702
2008-09-01 14:37:32 -07:00
Ken Thompson
33ee52727f fixed labels/break/continue/goto
R=r
OCL=14675
CL=14675
2008-08-29 20:30:19 -07:00
Ken Thompson
66a603c986 arrays
R=r
OCL=14603
CL=14603
2008-08-27 17:28:30 -07:00
Ken Thompson
30fd44cf9d fix fat copy of overlapping data
R=r
OCL=14417
CL=14417
2008-08-21 20:49:04 -07:00
Rob Pike
b59b551be7 allow predefined identifiers (len, etc.) to be exported.
(they were not accepted as names by the import parser)

R=ken
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=14159
CL=14159
2008-08-13 15:24:55 -07:00
Ken Thompson
ead7a6d47a i2s and i2i
R=r
OCL=14140
CL=14140
2008-08-12 16:36:18 -07:00
Ken Thompson
c1ab5a554f resolve go.y edits
R=r
OCL=14132
CL=14132
2008-08-12 14:28:58 -07:00
Ken Thompson
4797523572 fixed bugs in const/case
R=r
DELTA=138  (75 added, 12 deleted, 51 changed)
OCL=14129
CL=14131
2008-08-12 14:04:03 -07:00
Rob Pike
72d50900e3 fix a typo in the comments
R=ken
OCL=14104
CL=14104
2008-08-11 21:29:11 -07:00
Ken Thompson
a8a9dbc9c6 print() and field names
R=r
DELTA=86  (61 added, 3 deleted, 22 changed)
OCL=14099
CL=14099
2008-08-11 19:17:28 -07:00
Ken Thompson
9c2ade358d mp constants
R=r
DELTA=381  (142 added, 26 deleted, 213 changed)
OCL=14011
CL=14016
2008-08-08 17:13:31 -07:00
Ken Thompson
695f83a9e0 export external functions
R=r
DELTA=16  (10 added, 4 deleted, 2 changed)
OCL=13815
CL=13815
2008-08-04 13:18:59 -07:00
Ken Thompson
989676d2ba add 'export' adjectives to external
var, const and type declarations.

R=r
DELTA=49  (12 added, 28 deleted, 9 changed)
OCL=13791
CL=13791
2008-08-03 18:47:02 -07:00
Ken Thompson
b2d9020242 len now takes an expression
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=13523
CL=13523
2008-07-28 13:54:58 -07:00
Ken Thompson
b1abcc195d random bug fixes
R=r
DELTA=18  (6 added, 1 deleted, 11 changed)
OCL=13504
CL=13504
2008-07-27 13:09:15 -07:00
Ken Thompson
cb9b1038db select
R=r
APPROVED=r
DELTA=638  (433 added, 21 deleted, 184 changed)
OCL=13426
CL=13438
2008-07-24 15:57:30 -07:00
Ken Thompson
b78676a49d start of select
random bugs fixed

SVN=128149
2008-07-20 20:13:07 -07:00
Ken Thompson
f24f8ffae0 init
SVN=128128
2008-07-19 18:39:12 -07:00
Ken Thompson
fb3af53f4e initialization
SVN=128115
2008-07-19 13:38:29 -07:00
Ken Thompson
8003849498 parameter declartions in func literals
SVN=127678
2008-07-16 17:22:54 -07:00
Ken Thompson
ac048ce7f4 new chan syntax
SVN=127437
2008-07-15 21:07:59 -07:00
Ken Thompson
2d9ff40774 chan asynch
SVN=127121
2008-07-14 17:41:38 -07:00
Ken Thompson
3856e45e03 more on channels
arg space magic number for morestack

SVN=126936
2008-07-12 13:08:53 -07:00
Ken Thompson
0d079a5362 start of coroutine
SVN=126152
2008-07-07 12:29:26 -07:00
Ken Thompson
417a971f9a output args declared
arguments in first block for diagnostics
thomo return
better syntax error recovery

SVN=126045
2008-07-05 12:49:25 -07:00
Ken Thompson
1efa6a0544 better recovery after syntax error
SVN=126003
2008-07-03 18:05:20 -07:00
Ken Thompson
d915b96100 new iota
SVN=125984
2008-07-03 16:41:32 -07:00
Rob Pike
1f672596c5 fix a few spelling mistakes in messages
SVN=125108
2008-06-27 10:29:02 -07:00
Ken Thompson
54abac678a redeclarations of variables in the same block.
half-step toward multivalued map indexing

SVN=124019
2008-06-21 15:11:29 -07:00
Ken Thompson
c242b53d22 more maps
more semi-colons
type assignment of constants

SVN=123278
2008-06-17 22:33:32 -07:00
Ken Thompson
0006c83231 optional semi-colons
SVN=123245
2008-06-17 17:57:31 -07:00
Ken Thompson
e1a06ccc80 now checks for lvalue/rvalue context of
expressions.
start of generics for calling builtin
     functions
start of map type
'any' demoted from reserved word to type

SVN=122808
2008-06-15 20:24:30 -07:00
Ken Thompson
343f5aa7b4 better import/export
SVN=122584
2008-06-12 21:48:56 -07:00
Ken Thompson
2254a8ee99 import/export
SVN=122309
2008-06-11 21:06:26 -07:00
Ken Thompson
610644a1ca asdf
SVN=121615
2008-06-08 17:21:46 -07:00
Ken Thompson
36bfd2a906 floating point
SVN=121607
2008-06-08 16:11:14 -07:00
Ken Thompson
8200a0b088 optional semicolons
SVN=121604
2008-06-08 12:48:37 -07:00
Rob Pike
0cafb9ea3d Add compiler source to new directory structure
SVN=121164
2008-06-04 14:37:38 -07:00