Skip to content

Commit

Permalink
Add global vars and init function to axiomgen
Browse files Browse the repository at this point in the history
  • Loading branch information
upamanyus committed Dec 18, 2024
1 parent 9a8390c commit 61bdfc8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion axiomgen/goose.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ func Decl(w io.Writer, info types.Info, d ast.Decl) {
}
}
case token.VAR:
// return ctx.globalVarDecl(d)
for _, spec := range d.Specs {
spec := spec.(*ast.ValueSpec)
for _, name := range spec.Names {
if name.IsExported() {
fmt.Fprintf(w, "Axiom %s : (string * string).\n", name)
}
}
}
case token.TYPE:
for _, spec := range d.Specs {
spec := spec.(*ast.TypeSpec)
Expand All @@ -64,3 +71,7 @@ func Decl(w io.Writer, info types.Info, d ast.Decl) {
default:
}
}

func InitializeDecl(w io.Writer) {
fmt.Fprintf(w, "Axiom initialize' : val.")
}
1 change: 1 addition & 0 deletions cmd/goose_axiom/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func translate(pkgPatterns []string, outRootDir string, modDir string,
axiomgen.Decl(w, *pkg.TypesInfo, d)
}
}
axiomgen.InitializeDecl(w)
fmt.Fprintln(w, "\nEnd axioms.")
outFile := path.Join(outRootDir, glang.ImportToPath(pkg.PkgPath, pkg.Name))
outDir := path.Dir(outFile)
Expand Down

0 comments on commit 61bdfc8

Please sign in to comment.