You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
481 B

  1. package circuitcompiler
  2. import (
  3. "fmt"
  4. "strings"
  5. "testing"
  6. "github.com/stretchr/testify/assert"
  7. )
  8. func TestCircuitParser(t *testing.T) {
  9. /*
  10. input:
  11. def test():
  12. y = x**3
  13. return x + y + 5
  14. flattened:
  15. m1 = s1 * s1
  16. m2 = m1 * s1
  17. m3 = m2 + s1
  18. out = m3 + 5
  19. */
  20. raw := `
  21. y = x^x
  22. z = x + y
  23. out = z + 5
  24. `
  25. parser := NewParser(strings.NewReader(raw))
  26. res, err := parser.Parse()
  27. assert.Nil(t, err)
  28. fmt.Println(res)
  29. // flat code
  30. // flat code to R1CS
  31. }