Removed let phrases

We don't need them anymore
This commit is contained in:
Sasha Koshka 2022-09-29 02:37:14 -04:00
parent 290f8799cf
commit 94967d25e2
5 changed files with 26 additions and 19 deletions

View File

@ -101,9 +101,9 @@ func ro gControlFlow
[otherThing]
func ro hDataInit
---
[let x:Int 3]
[let y:{Int} [loc x]]
[let z:Int:8 (398 9 2309 983 -2387 478 555 123)]
[let bird:Bird ((99999) 324)]
[= x:Int 3]
[= y:{Int} [loc x]]
[= z:Int:8 (398 9 2309 983 -2387 478 555 123)]
[= bird:Bird ((99999) 324)]
`, test)
}

View File

@ -312,8 +312,6 @@ func (parser *ParsingOperation) parsePhraseCommand () (
identifier := command.value.(Identifier)
if len(identifier.trail) == 1 {
switch identifier.trail[0] {
case "let":
kind = PhraseKindLet
case "loc":
kind = PhraseKindReference
case "defer":

View File

@ -95,7 +95,7 @@ func (what Type) ToString () (output string) {
return
}
func (declaration Declaration) ToString (indent int) (output string) {
func (declaration Declaration) ToString () (output string) {
output += declaration.name + ":"
output += declaration.what.ToString()
return
@ -142,7 +142,7 @@ func (argument Argument) ToString (indent int, breakLine bool) (output string) {
case ArgumentKindDeclaration:
output += doIndent (
indent,
argument.value.(Declaration).ToString(indent))
argument.value.(Declaration).ToString())
if breakLine { output += "\n" }
case ArgumentKindInt, ArgumentKindUInt, ArgumentKindFloat:
@ -260,11 +260,11 @@ func (behavior FaceBehavior) ToString (indent int) (output string) {
output += doIndent(indent, behavior.name, "\n")
for _, inputItem := range behavior.inputs {
output += doIndent(indent + 1, "> ", inputItem.ToString(indent), "\n")
output += doIndent(indent + 1, "> ", inputItem.ToString(), "\n")
}
for _, outputItem := range behavior.outputs {
output += doIndent(indent + 1, "< ", outputItem.ToString(indent), "\n")
output += doIndent(indent + 1, "< ", outputItem.ToString(), "\n")
}
return
@ -280,7 +280,6 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
switch phrase.kind {
case
PhraseKindOperator,
PhraseKindLet,
PhraseKindAssign:
switch phrase.operator {
@ -373,6 +372,17 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
return
}
func (funcOutput FuncOutput) ToString (indent int) (output string) {
output += doIndent(indent + 1)
output += "< " + funcOutput.Declaration.ToString()
if funcOutput.argument.kind != ArgumentKindNil {
output += " " + funcOutput.argument.ToString(indent, false)
}
output += "\n"
return
}
func (block Block) ToString (indent int) (output string) {
for _, phrase := range block {
output += phrase.ToString(indent, true)
@ -391,15 +401,15 @@ func (section FuncSection) ToString (indent int) (output string) {
if section.receiver != nil {
output += doIndent (
indent + 1,
"@ ", section.receiver.ToString(indent), "\n")
"@ ", section.receiver.ToString(), "\n")
}
for _, inputItem := range section.inputs {
output += doIndent(indent + 1, "> ", inputItem.ToString(indent), "\n")
output += doIndent(indent + 1, "> ", inputItem.ToString(), "\n")
}
for _, outputItem := range section.outputs {
output += doIndent(indent + 1, "< ", outputItem.ToString(indent), "\n")
output += outputItem.ToString(indent)
}
output += doIndent(indent + 1, "---\n")

View File

@ -217,7 +217,6 @@ const (
PhraseKindCall = iota
PhraseKindCallExternal
PhraseKindOperator
PhraseKindLet
PhraseKindAssign
PhraseKindReference
PhraseKindDefer

View File

@ -124,11 +124,11 @@ func ro gControlFlow
func ro hDataInit
---
let x:Int 3
= x:Int 3
# loc is a reference, similar to * in C
let y:{Int} [loc x]
let z:Int:8 (398 9 2309 983 -2387
= y:{Int} [loc x]
= z:Int:8 (398 9 2309 983 -2387
478 555 123)
let bird:Bird (
= bird:Bird (
(99999)
324)