Comments (3)
Can you try this with PR#3?
from aeon.
That solved the problem about the import
I was getting another error and I thought that the syntax was wrong, but then I look to aeon_sugar.lark and the piece of code I was testing was syntactically correct
I was trying :
type Unit;
def math : Unit = native_import "math";
def test (b: {b:Float | ((b >= 1) && (b <= 100))}) ->
(e:{e:Float | ((e >= 1) && (e <= 100))}) -> Int {
native "lambda x: lambda y: math.pow(x , y)"
}
Raised this error:
(let math : Unit = (native_import "math") in
(let test : (b:{ b:Float | ((b >= 1) && (b <= 100)) }) -> (e:{ e:Float | ((e >= 1) && (e <= 100)) }) -> Int = (\b -> (native "lambda x: lambda y: math.pow(x , y)")) in
(print ?main)))
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/__main__.py", line 28, in <module>
if check_type(ctx, p, top):
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/typeinfer.py", line 267, in check_type
return entailment(ctx, constraint)
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/entailment.py", line 27, in entailment
return entailment(ctx.prev, c)
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/entailment.py", line 27, in entailment
return entailment(ctx.prev, c)
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/entailment.py", line 27, in entailment
return entailment(ctx.prev, c)
[Previous line repeated 11 more times]
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/entailment.py", line 23, in entailment
return solve(c)
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/horn.py", line 334, in solve
return smt_valid(c)
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 109, in smt_valid
smt_c = translate(c, extra=forall_vars)
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 200, in translate
e1 = translate_liq(c.pre, variables)
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in translate_liq
args = [translate_liq(a, variables) for a in t.args]
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in <listcomp>
args = [translate_liq(a, variables) for a in t.args]
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in translate_liq
args = [translate_liq(a, variables) for a in t.args]
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in <listcomp>
args = [translate_liq(a, variables) for a in t.args]
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in translate_liq
args = [translate_liq(a, variables) for a in t.args]
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in <listcomp>
args = [translate_liq(a, variables) for a in t.args]
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 187, in translate_liq
return f(*args)
File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 47, in <lambda>
">=": lambda x, y: x >= y,
TypeError: '>=' not supported between instances of 'ExprRef' and 'int'
But then I tried using Int instead of Float like this:
type Unit;
def math : Unit = native_import "math";
def test (b: {b:Int | ((b >= 1) && (b <= 100))}) ->
(e:{e:Int | ((e >= 1) && (e <= 100))}) -> Int {
native "lambda x: lambda y: math.pow(x , y)"
}
And it worked fine. I am now trying to figure out why its working with Int but not with Float
from aeon.
smt.py does not import t_float, so smt.py doesn't handle floats yet, I will try to add that now
from aeon.
Related Issues (20)
- Error messages with source location.
- Aeon formatter
- Aeon Language Server
- Documentation HOT 5
- Syntax: Parameter HOT 1
- Library: Property Based Testing
- Online playground
- Syntax: Function arguments
- Tool: AeonDoc
- Parsing time of fizzbuzz HOT 3
- Operator precedence support
- Support to different types of Fitness Decorators
- Integrate SysGus (CVC5) for synthesis of a valid subset
- MBPP benchmark
- PSB2 Examples
- Parsing time when importing functions
- 99 Problems Examples
- Remove the need to use () with decorators with no-arguments.
- Update GeneticEngine to the new API
- Optimising selective imports HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aeon.