alter-fixed-array-syntax #3
@ -3,7 +3,7 @@ require "io"
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func ro main
 | 
					func ro main
 | 
				
			||||||
	> arguments:{String}
 | 
						> arguments:{String ..}
 | 
				
			||||||
	< status:Int 0
 | 
						< status:Int 0
 | 
				
			||||||
	---
 | 
						---
 | 
				
			||||||
	io.println "hello world"
 | 
						io.println "hello world"
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,7 @@ objt ro Greeter:Obj
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# this is a function
 | 
					# this is a function
 | 
				
			||||||
func ro main
 | 
					func ro main
 | 
				
			||||||
	> arguments:{String}
 | 
						> arguments:{String ..}
 | 
				
			||||||
	< status:Int 0
 | 
						< status:Int 0
 | 
				
			||||||
	---
 | 
						---
 | 
				
			||||||
	= greeter:Greeter:mut
 | 
						= greeter:Greeter:mut
 | 
				
			||||||
 | 
				
			|||||||
@ -75,10 +75,11 @@ func (what Type) Mutable () (mutable bool) {
 | 
				
			|||||||
	return
 | 
						return
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Length returns the length of the type if the type is a fixed length array.
 | 
					// Length returns the length of the type. If it is greater than 1, that means
 | 
				
			||||||
// Otherwise, it just returns zero.
 | 
					// the type is a fixed length array.
 | 
				
			||||||
func (what Type) Length () (length uint64) {
 | 
					func (what Type) Length () (length uint64) {
 | 
				
			||||||
	if what.kind == TypeKindArray {
 | 
						length = 1
 | 
				
			||||||
 | 
						if what.length > 1 {
 | 
				
			||||||
		length = what.length
 | 
							length = what.length
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
 | 
				
			|||||||
@ -15,37 +15,37 @@ func (parser *ParsingOperation) parseBody () (err error) {
 | 
				
			|||||||
			section, parseErr := parser.parseDataSection()
 | 
								section, parseErr := parser.parseDataSection()
 | 
				
			||||||
			err = parser.tree.addSection(section)
 | 
								err = parser.tree.addSection(section)
 | 
				
			||||||
			if err      != nil { return }
 | 
								if err      != nil { return }
 | 
				
			||||||
			if parseErr != nil { return }
 | 
								if parseErr != nil { return parseErr }
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		case "type":
 | 
							case "type":
 | 
				
			||||||
			section, parseErr := parser.parseTypeSection()
 | 
								section, parseErr := parser.parseTypeSection()
 | 
				
			||||||
			err = parser.tree.addSection(section)
 | 
								err = parser.tree.addSection(section)
 | 
				
			||||||
			if err      != nil { return }
 | 
								if err      != nil { return }
 | 
				
			||||||
			if parseErr != nil { return }
 | 
								if parseErr != nil { return parseErr }
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		case "objt":
 | 
							case "objt":
 | 
				
			||||||
			section, parseErr := parser.parseObjtSection()
 | 
								section, parseErr := parser.parseObjtSection()
 | 
				
			||||||
			err = parser.tree.addSection(section)
 | 
								err = parser.tree.addSection(section)
 | 
				
			||||||
			if err      != nil { return }
 | 
								if err      != nil { return }
 | 
				
			||||||
			if parseErr != nil { return }
 | 
								if parseErr != nil { return parseErr }
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		case "face":
 | 
							case "face":
 | 
				
			||||||
			section, parseErr := parser.parseFaceSection()
 | 
								section, parseErr := parser.parseFaceSection()
 | 
				
			||||||
			err = parser.tree.addSection(section)
 | 
								err = parser.tree.addSection(section)
 | 
				
			||||||
			if err      != nil { return }
 | 
								if err      != nil { return }
 | 
				
			||||||
			if parseErr != nil { return }
 | 
								if parseErr != nil { return parseErr }
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		case "enum":
 | 
							case "enum":
 | 
				
			||||||
			section, parseErr := parser.parseEnumSection()
 | 
								section, parseErr := parser.parseEnumSection()
 | 
				
			||||||
			err = parser.tree.addSection(section)
 | 
								err = parser.tree.addSection(section)
 | 
				
			||||||
			if err      != nil { return }
 | 
								if err      != nil { return }
 | 
				
			||||||
			if parseErr != nil { return }
 | 
								if parseErr != nil { return parseErr }
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		case "func":
 | 
							case "func":
 | 
				
			||||||
			section, parseErr := parser.parseFuncSection()
 | 
								section, parseErr := parser.parseFuncSection()
 | 
				
			||||||
			err = parser.tree.addSection(section)
 | 
								err = parser.tree.addSection(section)
 | 
				
			||||||
			if err      != nil { return }
 | 
								if err      != nil { return }
 | 
				
			||||||
			if parseErr != nil { return }
 | 
								if parseErr != nil { return parseErr }
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			err = parser.token.NewError (
 | 
								err = parser.token.NewError (
 | 
				
			||||||
 | 
				
			|||||||
@ -6,9 +6,13 @@ func TestData (test *testing.T) {
 | 
				
			|||||||
	checkTree ("../tests/parser/data",
 | 
						checkTree ("../tests/parser/data",
 | 
				
			||||||
`:arf
 | 
					`:arf
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
data ro integer:Int 3202
 | 
					data ro aInteger:Int 3202
 | 
				
			||||||
data ro integerArray16:{Int 16}
 | 
					data ro bMutInteger:Int:mut 3202
 | 
				
			||||||
data ro integerArrayInitialized:{Int 16}
 | 
					data ro cIntegerPointer:{Int}
 | 
				
			||||||
 | 
					data ro dMutIntegerPointer:{Int}:mut
 | 
				
			||||||
 | 
					data ro eIntegerArray16:Int:16
 | 
				
			||||||
 | 
					data ro fIntegerArrayVariable:{Int ..}
 | 
				
			||||||
 | 
					data ro gIntegerArrayInitialized:Int:16
 | 
				
			||||||
	3948
 | 
						3948
 | 
				
			||||||
	293
 | 
						293
 | 
				
			||||||
	293049
 | 
						293049
 | 
				
			||||||
@ -20,19 +24,28 @@ data ro integerArrayInitialized:{Int 16}
 | 
				
			|||||||
	0
 | 
						0
 | 
				
			||||||
	4785
 | 
						4785
 | 
				
			||||||
	92
 | 
						92
 | 
				
			||||||
data ro integerArrayVariable:{Int ..}
 | 
					data ro jObject:thing.Thing.thing.thing
 | 
				
			||||||
data ro integerPointer:{Int}
 | 
						.that 2139
 | 
				
			||||||
data ro mutInteger:Int:mut 3202
 | 
						.this 324
 | 
				
			||||||
data ro mutIntegerPointer:{Int}:mut
 | 
					data ro kNestedObject:Obj
 | 
				
			||||||
data ro nestedObject:Obj
 | 
					 | 
				
			||||||
	.that
 | 
						.that
 | 
				
			||||||
		.bird2 123.8439
 | 
							.bird2 123.8439
 | 
				
			||||||
		.bird3 9328.21348239
 | 
							.bird3 9328.21348239
 | 
				
			||||||
	.this
 | 
						.this
 | 
				
			||||||
		.bird0 324
 | 
							.bird0 324
 | 
				
			||||||
		.bird1 "hello world"
 | 
							.bird1 "hello world"
 | 
				
			||||||
data ro object:thing.thing.thing.thing
 | 
					data ro lMutIntegerArray16:Int:16:mut
 | 
				
			||||||
	.that 2139
 | 
					data ro mIntegerArrayInitialized:Int:16:mut
 | 
				
			||||||
	.this 324
 | 
						3948
 | 
				
			||||||
 | 
						293
 | 
				
			||||||
 | 
						293049
 | 
				
			||||||
 | 
						948
 | 
				
			||||||
 | 
						912
 | 
				
			||||||
 | 
						340
 | 
				
			||||||
 | 
						0
 | 
				
			||||||
 | 
						2304
 | 
				
			||||||
 | 
						0
 | 
				
			||||||
 | 
						4785
 | 
				
			||||||
 | 
						92
 | 
				
			||||||
`, test)
 | 
					`, test)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@ func TestEnum (test *testing.T) {
 | 
				
			|||||||
	checkTree ("../tests/parser/enum",
 | 
						checkTree ("../tests/parser/enum",
 | 
				
			||||||
`:arf
 | 
					`:arf
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
enum ro AffrontToGod:{Int 4}
 | 
					enum ro AffrontToGod:Int:4
 | 
				
			||||||
	bird0
 | 
						bird0
 | 
				
			||||||
		28394
 | 
							28394
 | 
				
			||||||
		9328
 | 
							9328
 | 
				
			||||||
 | 
				
			|||||||
@ -25,7 +25,7 @@ func ro cBasicPhrases
 | 
				
			|||||||
	[fn [gn 329 983 57] 123]
 | 
						[fn [gn 329 983 57] 123]
 | 
				
			||||||
func ro dArgumentTypes
 | 
					func ro dArgumentTypes
 | 
				
			||||||
	---
 | 
						---
 | 
				
			||||||
	[bird tree butterfly.wing "hello world" grass:{Int:mut 8}]
 | 
						[bird tree butterfly.wing "hello world" grass:Int:8:mut]
 | 
				
			||||||
func ro eMath
 | 
					func ro eMath
 | 
				
			||||||
	> x:Int
 | 
						> x:Int
 | 
				
			||||||
	> y:Int
 | 
						> y:Int
 | 
				
			||||||
@ -103,7 +103,7 @@ func ro hSetPhrase
 | 
				
			|||||||
	---
 | 
						---
 | 
				
			||||||
	[= x:Int 3]
 | 
						[= x:Int 3]
 | 
				
			||||||
	[= y:{Int} [loc x]]
 | 
						[= y:{Int} [loc x]]
 | 
				
			||||||
	[= z:{Int 8}]
 | 
						[= z:Int:8]
 | 
				
			||||||
		398
 | 
							398
 | 
				
			||||||
		9
 | 
							9
 | 
				
			||||||
		2309
 | 
							2309
 | 
				
			||||||
 | 
				
			|||||||
@ -44,19 +44,11 @@ func (parser *ParsingOperation) parseType () (what Type, err error) {
 | 
				
			|||||||
		what.points = &points
 | 
							what.points = &points
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		err = parser.expect (
 | 
							err = parser.expect (
 | 
				
			||||||
			lexer.TokenKindUInt,
 | 
					 | 
				
			||||||
			lexer.TokenKindRBrace,
 | 
								lexer.TokenKindRBrace,
 | 
				
			||||||
			lexer.TokenKindElipsis)
 | 
								lexer.TokenKindElipsis)
 | 
				
			||||||
		if err != nil { return }
 | 
							if err != nil { return }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if parser.token.Is(lexer.TokenKindUInt) {
 | 
							if parser.token.Is(lexer.TokenKindElipsis) {
 | 
				
			||||||
			what.kind = TypeKindArray
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
			what.length = parser.token.Value().(uint64)
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
			err = parser.nextToken(lexer.TokenKindRBrace)
 | 
					 | 
				
			||||||
			if err != nil { return }
 | 
					 | 
				
			||||||
		} else if parser.token.Is(lexer.TokenKindElipsis) {
 | 
					 | 
				
			||||||
			what.kind = TypeKindVariableArray
 | 
								what.kind = TypeKindVariableArray
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
			err = parser.nextToken(lexer.TokenKindRBrace)
 | 
								err = parser.nextToken(lexer.TokenKindRBrace)
 | 
				
			||||||
@ -70,20 +62,29 @@ func (parser *ParsingOperation) parseType () (what Type, err error) {
 | 
				
			|||||||
		if err != nil { return }
 | 
							if err != nil { return }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if parser.token.Is(lexer.TokenKindColon) {
 | 
						for {
 | 
				
			||||||
		err = parser.nextToken(lexer.TokenKindName)
 | 
							if !parser.token.Is(lexer.TokenKindColon) { break }
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							err = parser.nextToken(lexer.TokenKindName, lexer.TokenKindUInt)
 | 
				
			||||||
		if err != nil { return }
 | 
							if err != nil { return }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if parser.token.Is(lexer.TokenKindName) {
 | 
				
			||||||
 | 
								// parse type qualifier
 | 
				
			||||||
			qualifier := parser.token.Value().(string)
 | 
								qualifier := parser.token.Value().(string)
 | 
				
			||||||
			switch qualifier {
 | 
								switch qualifier {
 | 
				
			||||||
			case "mut":
 | 
								case "mut":
 | 
				
			||||||
				what.mutable = true
 | 
									what.mutable = true
 | 
				
			||||||
			default:
 | 
								default:
 | 
				
			||||||
				err = parser.token.NewError (
 | 
									err = parser.token.NewError (
 | 
				
			||||||
				"unknown type qualifier \"" + qualifier + "\"",
 | 
										"unknown type qualifier \"" +
 | 
				
			||||||
 | 
										qualifier + "\"",
 | 
				
			||||||
					infoerr.ErrorKindError)
 | 
										infoerr.ErrorKindError)
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								// parse fixed array length
 | 
				
			||||||
 | 
								what.length = parser.token.Value().(uint64)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		err = parser.nextToken()
 | 
							err = parser.nextToken()
 | 
				
			||||||
		if err != nil { return }
 | 
							if err != nil { return }
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,7 @@ objt ro BitFields:Obj
 | 
				
			|||||||
	ro that:Int & 1
 | 
						ro that:Int & 1
 | 
				
			||||||
	ro this:Int & 24 298
 | 
						ro this:Int & 24 298
 | 
				
			||||||
objt ro ComplexInit:Obj
 | 
					objt ro ComplexInit:Obj
 | 
				
			||||||
	ro whatever:{Int 3}
 | 
						ro whatever:Int:3
 | 
				
			||||||
		230984
 | 
							230984
 | 
				
			||||||
		849
 | 
							849
 | 
				
			||||||
		394580
 | 
							394580
 | 
				
			||||||
 | 
				
			|||||||
@ -73,15 +73,17 @@ func (what Type) ToString () (output string) {
 | 
				
			|||||||
		output += "{"
 | 
							output += "{"
 | 
				
			||||||
		output += what.points.ToString()
 | 
							output += what.points.ToString()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if what.kind == TypeKindArray {
 | 
							if what.kind == TypeKindVariableArray {
 | 
				
			||||||
			output += fmt.Sprint(" ", what.length)
 | 
					 | 
				
			||||||
		} else if what.kind == TypeKindVariableArray {
 | 
					 | 
				
			||||||
			output += " .."
 | 
								output += " .."
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		output += "}"
 | 
							output += "}"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if what.length > 1 {
 | 
				
			||||||
 | 
							output += fmt.Sprint(":", what.length)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	if what.mutable {
 | 
						if what.mutable {
 | 
				
			||||||
		output += ":mut"
 | 
							output += ":mut"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
@ -55,9 +55,6 @@ const (
 | 
				
			|||||||
	// TypeKindPointer means it's a pointer
 | 
						// TypeKindPointer means it's a pointer
 | 
				
			||||||
	TypeKindPointer
 | 
						TypeKindPointer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TypeKindArray means it's a fixed length array.
 | 
					 | 
				
			||||||
	TypeKindArray
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// TypeKindVariableArray means it's an array of variable length.
 | 
						// TypeKindVariableArray means it's an array of variable length.
 | 
				
			||||||
	TypeKindVariableArray
 | 
						TypeKindVariableArray
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@ -68,8 +65,6 @@ type Type struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	mutable bool
 | 
						mutable bool
 | 
				
			||||||
	kind TypeKind
 | 
						kind TypeKind
 | 
				
			||||||
 | 
					 | 
				
			||||||
	// only applicable for fixed length arrays.
 | 
					 | 
				
			||||||
	length uint64
 | 
						length uint64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// only applicable for basic.
 | 
						// only applicable for basic.
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ func TestType (test *testing.T) {
 | 
				
			|||||||
type ro Basic:Int
 | 
					type ro Basic:Int
 | 
				
			||||||
type ro BasicInit:Int 6
 | 
					type ro BasicInit:Int 6
 | 
				
			||||||
type ro IntArray:{Int ..}
 | 
					type ro IntArray:{Int ..}
 | 
				
			||||||
type ro IntArrayInit:{Int 3}
 | 
					type ro IntArrayInit:Int:3
 | 
				
			||||||
	3298
 | 
						3298
 | 
				
			||||||
	923
 | 
						923
 | 
				
			||||||
	92
 | 
						92
 | 
				
			||||||
 | 
				
			|||||||
@ -1,34 +1,34 @@
 | 
				
			|||||||
:arf
 | 
					:arf
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data ro integer:Int 3202
 | 
					data ro aInteger:Int 3202
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data ro mutInteger:Int:mut 3202
 | 
					data ro bMutInteger:Int:mut 3202
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data ro integerPointer:{Int}
 | 
					data ro cIntegerPointer:{Int}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data ro mutIntegerPointer:{Int}:mut
 | 
					data ro dMutIntegerPointer:{Int}:mut
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data ro integerArray16:{Int 16}
 | 
					data ro eIntegerArray16:Int:16
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data ro integerArrayVariable:{Int ..}
 | 
					data ro fIntegerArrayVariable:{Int ..}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data ro integerArrayInitialized:{Int 16}
 | 
					data ro gIntegerArrayInitialized:Int:16
 | 
				
			||||||
	3948 293 293049 948 912
 | 
						3948 293 293049 948 912
 | 
				
			||||||
	340 0 2304 0 4785 92
 | 
						340 0 2304 0 4785 92
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO: reinstate these two after phrase parsing is implemented
 | 
					# TODO: reinstate these two after phrase parsing is implemented
 | 
				
			||||||
# data wr integerPointerInit:{Int} [& integer]
 | 
					# data wr hIntegerPointerInit:{Int} [& integer]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# data wr mutIntegerPointerInit:{Int}:mut [& integer]
 | 
					# data wr iMutIntegerPointerInit:{Int}:mut [& integer]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO: maybe test identifiers somewhere else?
 | 
					# TODO: maybe test identifiers somewhere else?
 | 
				
			||||||
data ro object:thing.thing.
 | 
					data ro jObject:thing.Thing.
 | 
				
			||||||
	thing.thing
 | 
						thing.thing
 | 
				
			||||||
	.this 324
 | 
						.this 324
 | 
				
			||||||
	.that 2139
 | 
						.that 2139
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data ro nestedObject:Obj
 | 
					data ro kNestedObject:Obj
 | 
				
			||||||
	.this
 | 
						.this
 | 
				
			||||||
		.bird0 324
 | 
							.bird0 324
 | 
				
			||||||
		.bird1 "hello world"
 | 
							.bird1 "hello world"
 | 
				
			||||||
@ -36,19 +36,8 @@ data ro nestedObject:Obj
 | 
				
			|||||||
		.bird2 123.8439
 | 
							.bird2 123.8439
 | 
				
			||||||
		.bird3 9328.21348239
 | 
							.bird3 9328.21348239
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					data ro lMutIntegerArray16:Int:16:mut
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# func ro main
 | 
					data ro mIntegerArrayInitialized:Int:16:mut
 | 
				
			||||||
	# ---
 | 
						3948 293 293049 948 912
 | 
				
			||||||
	# # TODO: set should be a special case, checking under itself for object
 | 
						340 0 2304 0 4785 92
 | 
				
			||||||
	# member initialization args. it should also check for args in general
 | 
					 | 
				
			||||||
	# under there which should be treated as array initialization args.
 | 
					 | 
				
			||||||
	# basically, under a set phrase, it should do the same checks that it
 | 
					 | 
				
			||||||
	# does under a data section.
 | 
					 | 
				
			||||||
	#
 | 
					 | 
				
			||||||
	# [set object:Obj]
 | 
					 | 
				
			||||||
		# .this 324
 | 
					 | 
				
			||||||
		# .that 2139
 | 
					 | 
				
			||||||
	# 
 | 
					 | 
				
			||||||
	# set object:Obj 
 | 
					 | 
				
			||||||
	#	.this 324
 | 
					 | 
				
			||||||
	#	.that 2139
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@ enum ro NamedColor:U32
 | 
				
			|||||||
	green 0x00FF00
 | 
						green 0x00FF00
 | 
				
			||||||
	blue  0x0000FF
 | 
						blue  0x0000FF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum ro AffrontToGod:{Int 4}
 | 
					enum ro AffrontToGod:Int:4
 | 
				
			||||||
	bird0
 | 
						bird0
 | 
				
			||||||
		28394 9328
 | 
							28394 9328
 | 
				
			||||||
		398 9
 | 
							398 9
 | 
				
			||||||
 | 
				
			|||||||
@ -5,35 +5,29 @@ require "io"
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# this is a global variable
 | 
					# this is a global variable
 | 
				
			||||||
data wn helloText:String "Hello, world!"
 | 
					data pv helloText:String "Hello, world!"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# this is a struct definition
 | 
					# this is a struct definition
 | 
				
			||||||
type rr Greeter:Obj
 | 
					objt ro Greeter:Obj
 | 
				
			||||||
        # "Hi." is a string constant. all Greeters will be initialized with a
 | 
						rw text:String "Hi."
 | 
				
			||||||
        # pointer to it. I don't know really it depends on what I decide that
 | 
					 | 
				
			||||||
        # a String type even is.
 | 
					 | 
				
			||||||
        wr text:String "Hi."
 | 
					 | 
				
			||||||
                "sdfdsf" "ahh"
 | 
					 | 
				
			||||||
                "asdf"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# this is a function
 | 
					# this is a function
 | 
				
			||||||
func rr main
 | 
					func ro main
 | 
				
			||||||
        > argc:Int
 | 
						> arguments:{String ..}
 | 
				
			||||||
        > argv:{String}
 | 
					 | 
				
			||||||
	< status:Int 0
 | 
						< status:Int 0
 | 
				
			||||||
	---
 | 
						---
 | 
				
			||||||
        let greeter:Greeter:mut
 | 
						= greeter:Greeter:mut
 | 
				
			||||||
	greeter.setText helloText
 | 
						greeter.setText helloText
 | 
				
			||||||
	greeter.greet
 | 
						greeter.greet
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# this is a member function
 | 
					# this is a member function
 | 
				
			||||||
func rr greet
 | 
					func ro greet
 | 
				
			||||||
	@ greeter:{Greeter}
 | 
						@ greeter:{Greeter}
 | 
				
			||||||
	---
 | 
						---
 | 
				
			||||||
	io.println greeter.text
 | 
						io.println greeter.text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# this is mutator member function
 | 
					# this is mutator member function
 | 
				
			||||||
func rr setText
 | 
					func ro setText
 | 
				
			||||||
	@ greeter:{Greeter}
 | 
						@ greeter:{Greeter}
 | 
				
			||||||
	> text:String
 | 
						> text:String
 | 
				
			||||||
	---
 | 
						---
 | 
				
			||||||
 | 
				
			|||||||
@ -28,7 +28,7 @@ func ro cBasicPhrases
 | 
				
			|||||||
func ro dArgumentTypes
 | 
					func ro dArgumentTypes
 | 
				
			||||||
	---
 | 
						---
 | 
				
			||||||
	[bird tree butterfly.wing "hello world"
 | 
						[bird tree butterfly.wing "hello world"
 | 
				
			||||||
		grass:{Int:mut 8}]
 | 
							grass:Int:mut:8]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func ro eMath
 | 
					func ro eMath
 | 
				
			||||||
	> x:Int
 | 
						> x:Int
 | 
				
			||||||
@ -127,7 +127,7 @@ func ro hSetPhrase
 | 
				
			|||||||
	= x:Int 3
 | 
						= x:Int 3
 | 
				
			||||||
	# loc is a reference, similar to * in C
 | 
						# loc is a reference, similar to * in C
 | 
				
			||||||
	= y:{Int} [loc x]
 | 
						= y:{Int} [loc x]
 | 
				
			||||||
	= z:{Int 8}
 | 
						= z:Int:8
 | 
				
			||||||
		398 9 2309 983 -2387
 | 
							398 9 2309 983 -2387
 | 
				
			||||||
		478 555 123
 | 
							478 555 123
 | 
				
			||||||
	= bird:Bird
 | 
						= bird:Bird
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,7 @@ objt ro Init:Obj
 | 
				
			|||||||
	ro this:Int 23
 | 
						ro this:Int 23
 | 
				
			||||||
 | 
					
 | 
				
			||||||
objt ro ComplexInit:Obj
 | 
					objt ro ComplexInit:Obj
 | 
				
			||||||
	ro whatever:{Int 3}
 | 
						ro whatever:Int:3
 | 
				
			||||||
		230984
 | 
							230984
 | 
				
			||||||
		849 394580
 | 
							849 394580
 | 
				
			||||||
	ro complex0:Bird
 | 
						ro complex0:Bird
 | 
				
			||||||
 | 
				
			|||||||
@ -6,5 +6,5 @@ type ro BasicInit:Int 6
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type ro IntArray:{Int ..}
 | 
					type ro IntArray:{Int ..}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ro IntArrayInit:{Int 3}
 | 
					type ro IntArrayInit:Int:3
 | 
				
			||||||
	3298 923 92
 | 
						3298 923 92
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user