Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ z
out.txt
complex_tests/**/*.v
complex_tests/**/*.vv
translate_esbuild
88 changes: 88 additions & 0 deletions idioms/001a/001a.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package main

type AutoGenerated struct {
Type string `json:"_type"`
Doc any `json:"Doc"`
Package any `json:"Package"`
Name Name `json:"Name"`
Decls []Decls `json:"Decls"`
Imports any `json:"Imports"`
Unresolved any `json:"Unresolved"`
Comments any `json:"Comments"`
FileSet FileSet `json:"FileSet"`
}
type Name struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Path struct {
Type string `json:"_type"`
Kind string `json:"Kind"`
Value string `json:"Value"`
}
type Specs struct {
Type string `json:"_type"`
Name any `json:"Name"`
Path Path `json:"Path"`
}
type Params struct {
Type string `json:"_type"`
List any `json:"List"`
}
type Type0 struct {
Type string `json:"_type"`
TypeParams any `json:"TypeParams"`
Params Params `json:"Params"`
Results any `json:"Results"`
}
type X struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Sel struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Fun struct {
Type string `json:"_type"`
X X `json:"X"`
Sel Sel `json:"Sel"`
}
type Args struct {
Type string `json:"_type"`
Kind string `json:"Kind"`
Value string `json:"Value"`
}
type X struct {
Type string `json:"_type"`
Fun Fun `json:"Fun"`
Args []Args `json:"Args"`
}
type List struct {
Type string `json:"_type"`
X X `json:"X"`
}
type Body struct {
Type string `json:"_type"`
List []List `json:"List"`
}
type Decls struct {
Type string `json:"_type"`
Tok string `json:"Tok,omitempty"`
Specs []Specs `json:"Specs,omitempty"`
Recv any `json:"Recv,omitempty"`
Name Name `json:"Name,omitempty"`
Type0 Type0 `json:"Type,omitempty"`
Body Body `json:"Body,omitempty"`
}
type Files struct {
Name string `json:"Name"`
Base int `json:"Base"`
Size int `json:"Size"`
Lines []int `json:"Lines"`
Infos any `json:"Infos"`
}
type FileSet struct {
Base int `json:"Base"`
Files []Files `json:"Files"`
}
7 changes: 7 additions & 0 deletions idioms/001a_print_hello_world/001a_print_hello_world.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("Hello World")
}
67 changes: 67 additions & 0 deletions idioms/001b/001b.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package main

type AutoGenerated struct {
Type string `json:"_type"`
Doc any `json:"Doc"`
Package any `json:"Package"`
Name Name `json:"Name"`
Decls []Decls `json:"Decls"`
Imports any `json:"Imports"`
Unresolved any `json:"Unresolved"`
Comments any `json:"Comments"`
FileSet FileSet `json:"FileSet"`
}
type Name struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Params struct {
Type string `json:"_type"`
List any `json:"List"`
}
type Type0 struct {
Type string `json:"_type"`
TypeParams any `json:"TypeParams"`
Params Params `json:"Params"`
Results any `json:"Results"`
}
type Fun struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Args struct {
Type string `json:"_type"`
Kind string `json:"Kind"`
Value string `json:"Value"`
}
type X struct {
Type string `json:"_type"`
Fun Fun `json:"Fun"`
Args []Args `json:"Args"`
}
type List struct {
Type string `json:"_type"`
X X `json:"X"`
}
type Body struct {
Type string `json:"_type"`
List []List `json:"List"`
}
type Decls struct {
Type string `json:"_type"`
Recv any `json:"Recv"`
Name Name `json:"Name"`
Type0 Type0 `json:"Type"`
Body Body `json:"Body"`
}
type Files struct {
Name string `json:"Name"`
Base int `json:"Base"`
Size int `json:"Size"`
Lines []int `json:"Lines"`
Infos any `json:"Infos"`
}
type FileSet struct {
Base int `json:"Base"`
Files []Files `json:"Files"`
}
2 changes: 2 additions & 0 deletions idioms/001b_print_hello_world/001b_print_hello_world.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package main
func main(){print("Hello World")}
103 changes: 103 additions & 0 deletions idioms/002a/002a.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package main

type AutoGenerated struct {
Type string `json:"_type"`
Doc any `json:"Doc"`
Package any `json:"Package"`
Name Name `json:"Name"`
Decls []Decls `json:"Decls"`
Imports any `json:"Imports"`
Unresolved any `json:"Unresolved"`
Comments any `json:"Comments"`
FileSet FileSet `json:"FileSet"`
}
type Name struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Path struct {
Type string `json:"_type"`
Kind string `json:"Kind"`
Value string `json:"Value"`
}
type Specs struct {
Type string `json:"_type"`
Name any `json:"Name"`
Path Path `json:"Path"`
}
type Params struct {
Type string `json:"_type"`
List any `json:"List"`
}
type Type0 struct {
Type string `json:"_type"`
TypeParams any `json:"TypeParams"`
Params Params `json:"Params"`
Results any `json:"Results"`
}
type LHS struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type RHS struct {
Type string `json:"_type"`
Kind string `json:"Kind"`
Value string `json:"Value"`
}
type Init struct {
Type string `json:"_type"`
LHS []LHS `json:"Lhs"`
Tok string `json:"Tok"`
RHS []RHS `json:"Rhs"`
}
type X struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Y struct {
Type string `json:"_type"`
Kind string `json:"Kind"`
Value string `json:"Value"`
}
type Cond struct {
Type string `json:"_type"`
X X `json:"X"`
Op string `json:"Op"`
Y Y `json:"Y"`
}
type Post struct {
Type string `json:"_type"`
X X `json:"X"`
Tok string `json:"Tok"`
}
type List struct {
Type string `json:"_type"`
Init Init `json:"Init"`
Cond Cond `json:"Cond"`
Post Post `json:"Post"`
Body Body `json:"Body"`
}
type Body struct {
Type string `json:"_type"`
List []List `json:"List"`
}
type Decls struct {
Type string `json:"_type"`
Tok string `json:"Tok,omitempty"`
Specs []Specs `json:"Specs,omitempty"`
Recv any `json:"Recv,omitempty"`
Name Name `json:"Name,omitempty"`
Type0 Type0 `json:"Type,omitempty"`
Body Body `json:"Body,omitempty"`
}
type Files struct {
Name string `json:"Name"`
Base int `json:"Base"`
Size int `json:"Size"`
Lines []int `json:"Lines"`
Infos any `json:"Infos"`
}
type FileSet struct {
Base int `json:"Base"`
Files []Files `json:"Files"`
}
11 changes: 11 additions & 0 deletions idioms/002a_print_hello_10_times/002a_print_hello_10_times.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import (
"fmt"
)

func main() {
for i := 0; i < 10; i++ {
fmt.Println("Hello")
}
}
93 changes: 93 additions & 0 deletions idioms/002b/002b.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package main

type AutoGenerated struct {
Type string `json:"_type"`
Doc any `json:"Doc"`
Package any `json:"Package"`
Name Name `json:"Name"`
Decls []Decls `json:"Decls"`
Imports any `json:"Imports"`
Unresolved any `json:"Unresolved"`
Comments any `json:"Comments"`
FileSet FileSet `json:"FileSet"`
}
type Name struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Path struct {
Type string `json:"_type"`
Kind string `json:"Kind"`
Value string `json:"Value"`
}
type Specs struct {
Type string `json:"_type"`
Name any `json:"Name"`
Path Path `json:"Path"`
}
type Params struct {
Type string `json:"_type"`
List any `json:"List"`
}
type Type0 struct {
Type string `json:"_type"`
TypeParams any `json:"TypeParams"`
Params Params `json:"Params"`
Results any `json:"Results"`
}
type X struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Sel struct {
Type string `json:"_type"`
Name string `json:"Name"`
}
type Fun struct {
Type string `json:"_type"`
X X `json:"X"`
Sel Sel `json:"Sel"`
}
type Args struct {
Type string `json:"_type"`
Kind string `json:"Kind"`
Value string `json:"Value"`
}
type Args struct {
Type string `json:"_type"`
Fun Fun `json:"Fun"`
Args []Args `json:"Args"`
}
type X struct {
Type string `json:"_type"`
Fun Fun `json:"Fun"`
Args []Args `json:"Args"`
}
type List struct {
Type string `json:"_type"`
X X `json:"X"`
}
type Body struct {
Type string `json:"_type"`
List []List `json:"List"`
}
type Decls struct {
Type string `json:"_type"`
Tok string `json:"Tok,omitempty"`
Specs []Specs `json:"Specs,omitempty"`
Recv any `json:"Recv,omitempty"`
Name Name `json:"Name,omitempty"`
Type0 Type0 `json:"Type,omitempty"`
Body Body `json:"Body,omitempty"`
}
type Files struct {
Name string `json:"Name"`
Base int `json:"Base"`
Size int `json:"Size"`
Lines []int `json:"Lines"`
Infos any `json:"Infos"`
}
type FileSet struct {
Base int `json:"Base"`
Files []Files `json:"Files"`
}
10 changes: 10 additions & 0 deletions idioms/002b_print_hello_10_times/002b_print_hello_10_times.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package main

import (
"fmt"
"strings"
)

func main() {
fmt.Println(strings.Repeat("Hello\n", 10))
}
Loading
Loading