Can ATS support LMS style embedded compiler?

LMS stands for Lightweight Modular Staging http://scala-lms.github.io/.
For a definitive guide see Tiark Rompf’s Ph.D. dissertation
http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without
Regret for High-Level High-Performance Programming
I am still studying it
but this seems like a very interesting approach to solve the expression
problem without sacrificing performance. Let me quote from the tutorial page
http://scala-lms.github.io/tutorials/index.html:

"Why Generative Programming ?

Because it enables abstraction without regret: the key idea is to write
very high-level
and generic programs that generate specialized and extremely fast low-level
code at runtime.

Programming abstractions that would usually be avoided in
performance-sensitive code
(objects, type classes, higher-order functions) can be used during
generation without
affecting performance of the generated code.

Why LMS ?

Because it is lightweight and modular: LMS is just a Scala library. With
types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).

LMS comes with batteries included: it provides many optimizations such as
common subexpression elimination out of the box, and it goes beyond purely
generative approaches by
providing an extensible intermediate representation that can be used to
implement
sophisticated domain-specific compiler pipelines.

At the same time LMS is hackable: since it is just a library, all aspects
can be
modified or extended to suit a particular purpose."

I wonder if ATS’s very expressive approach can support such a paradigm. For
a motivational example (motivation for me anyway) see:A SQL Query Compiler
http://scala-lms.github.io/tutorials/query.html. This approach is used in
LegoBase http://data.epfl.ch/legobase to very good effect. I think it is
very attractive if we can mix in relational declarative programming this
way with imperative programming that can supply large amount of libraries
and take care of side effects.

ATS itself is a code transformer (at compile time) but can it also easily
let users write a domain specific transformer (at run time) on their own?
Can ATS’s dependent type system provide a better tool?

Yes, I would think so.

The type system of ATS makes it highly suitable for dealing with (typeful)
syntax trees.

Also, I suppose that the compiler for a query language should itself be
efficient if it is used on-line.On Sun, Feb 8, 2015 at 6:03 PM, Haitao Zhang zht...@gmail.com wrote:

Yes that is what I vaguely understood as well and why I asked the question
here. However a LMS program is a user defined specializer that generates
another program so you can start with a query string and end with a C
program (another string). The underlying virtualized Scala is used to
ensure type safety. LMS also provides facilities to rewrite the code using
the IR. How can one achieve the same with ATS? ATS itself is a code
transformer (at compile time) but can it also easily let users write a
domain specific transformer (at run time) on their own? Can ATS’s dependent
type system provide a better tool?

On Sun, Feb 8, 2015 at 2:11 PM, gmhwxi gmh...@gmail.com wrote:

I took a quick look at LMS.

I feel that the template system of ATS is already a kind of LMS.
Instead of using an intermediate representation, ATS uses a small set of
C and then relies on an optimizing C compiler to get efficient object
code.
Compared to LMS, the template-based approach of ATS is more
direct and flexible.

I am not familiar with compiling query languages, though.

On Sunday, February 8, 2015 at 2:20:23 PM UTC-5, H Zhang wrote:

LMS stands for Lightweight Modular Staging http://scala-lms.github.io/.
For a definitive guide see Tiark Rompf’s Ph.D. dissertation
http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without
Regret for High-Level High-Performance Programming
I am still studying
it but this seems like a very interesting approach to solve the expression
problem without sacrificing performance. Let me quote from the tutorial
page http://scala-lms.github.io/tutorials/index.html:

"Why Generative Programming ?

Because it enables abstraction without regret: the key idea is to write
very high-level
and generic programs that generate specialized and extremely fast
low-level code at runtime.

Programming abstractions that would usually be avoided in
performance-sensitive code
(objects, type classes, higher-order functions) can be used during
generation without
affecting performance of the generated code.

Why LMS ?

Because it is lightweight and modular: LMS is just a Scala library. With
types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).

LMS comes with batteries included: it provides many optimizations such
as common subexpression elimination out of the box, and it goes beyond
purely generative approaches by
providing an extensible intermediate representation that can be used to
implement
sophisticated domain-specific compiler pipelines.

At the same time LMS is hackable: since it is just a library, all
aspects can be
modified or extended to suit a particular purpose."

I wonder if ATS’s very expressive approach can support such a paradigm.
For a motivational example (motivation for me anyway) see:A SQL Query
Compiler http://scala-lms.github.io/tutorials/query.html. This
approach is used in LegoBase http://data.epfl.ch/legobase to very
good effect. I think it is very attractive if we can mix in relational
declarative programming this way with imperative programming that can
supply large amount of libraries and take care of side effects.


You received this message because you are subscribed to a topic in the
Google Groups “ats-lang-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ats-lang-users/vgjuDIMcXYI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com?utm_medium=email&utm_source=footer
.


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/CAFUyvhqR6P%3DY%3DPh_VMb3XP_6OMH10T5RYHnkPXR9Jdhj9fAUcQ%40mail.gmail.com
https://groups.google.com/d/msgid/ats-lang-users/CAFUyvhqR6P%3DY%3DPh_VMb3XP_6OMH10T5RYHnkPXR9Jdhj9fAUcQ%40mail.gmail.com?utm_medium=email&utm_source=footer
.

This paper http://theory.stanford.edu/~aiken/publications/papers/pldi11b.pdf
is shorter and more succinct.On Sun, Feb 8, 2015 at 11:40 PM, Haitao Zhang zht...@gmail.com wrote:

RelC as described in this dissertation
http://theory.stanford.edu/~aiken/publications/theses/hawkins.pdf is a
good approximation of what I would like to see in synthesizing code from
relational descriptions. The dissertation does not give implementation
details.

On Sun, Feb 8, 2015 at 2:11 PM, gmhwxi gmh...@gmail.com wrote:

I took a quick look at LMS.

I feel that the template system of ATS is already a kind of LMS.
Instead of using an intermediate representation, ATS uses a small set of
C and then relies on an optimizing C compiler to get efficient object
code.
Compared to LMS, the template-based approach of ATS is more
direct and flexible.

I am not familiar with compiling query languages, though.

On Sunday, February 8, 2015 at 2:20:23 PM UTC-5, H Zhang wrote:

LMS stands for Lightweight Modular Staging http://scala-lms.github.io/.
For a definitive guide see Tiark Rompf’s Ph.D. dissertation
http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without
Regret for High-Level High-Performance Programming
I am still studying
it but this seems like a very interesting approach to solve the expression
problem without sacrificing performance. Let me quote from the tutorial
page http://scala-lms.github.io/tutorials/index.html:

"Why Generative Programming ?

Because it enables abstraction without regret: the key idea is to write
very high-level
and generic programs that generate specialized and extremely fast
low-level code at runtime.

Programming abstractions that would usually be avoided in
performance-sensitive code
(objects, type classes, higher-order functions) can be used during
generation without
affecting performance of the generated code.

Why LMS ?

Because it is lightweight and modular: LMS is just a Scala library. With
types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).

LMS comes with batteries included: it provides many optimizations such
as common subexpression elimination out of the box, and it goes beyond
purely generative approaches by
providing an extensible intermediate representation that can be used to
implement
sophisticated domain-specific compiler pipelines.

At the same time LMS is hackable: since it is just a library, all
aspects can be
modified or extended to suit a particular purpose."

I wonder if ATS’s very expressive approach can support such a paradigm.
For a motivational example (motivation for me anyway) see:A SQL Query
Compiler http://scala-lms.github.io/tutorials/query.html. This
approach is used in LegoBase http://data.epfl.ch/legobase to very
good effect. I think it is very attractive if we can mix in relational
declarative programming this way with imperative programming that can
supply large amount of libraries and take care of side effects.


You received this message because you are subscribed to a topic in the
Google Groups “ats-lang-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ats-lang-users/vgjuDIMcXYI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com?utm_medium=email&utm_source=footer
.

RelC as described in this dissertation
http://theory.stanford.edu/~aiken/publications/theses/hawkins.pdf is a good
approximation of what I would like to see in synthesizing code from
relational descriptions. The dissertation does not give implementation
details.On Sun, Feb 8, 2015 at 2:11 PM, gmhwxi gmh...@gmail.com wrote:

I took a quick look at LMS.

I feel that the template system of ATS is already a kind of LMS.
Instead of using an intermediate representation, ATS uses a small set of
C and then relies on an optimizing C compiler to get efficient object code.
Compared to LMS, the template-based approach of ATS is more
direct and flexible.

I am not familiar with compiling query languages, though.

On Sunday, February 8, 2015 at 2:20:23 PM UTC-5, H Zhang wrote:

LMS stands for Lightweight Modular Staging http://scala-lms.github.io/.
For a definitive guide see Tiark Rompf’s Ph.D. dissertation
http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without
Regret for High-Level High-Performance Programming
I am still studying
it but this seems like a very interesting approach to solve the expression
problem without sacrificing performance. Let me quote from the tutorial
page http://scala-lms.github.io/tutorials/index.html:

"Why Generative Programming ?

Because it enables abstraction without regret: the key idea is to write
very high-level
and generic programs that generate specialized and extremely fast
low-level code at runtime.

Programming abstractions that would usually be avoided in
performance-sensitive code
(objects, type classes, higher-order functions) can be used during
generation without
affecting performance of the generated code.

Why LMS ?

Because it is lightweight and modular: LMS is just a Scala library. With
types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).

LMS comes with batteries included: it provides many optimizations such as
common subexpression elimination out of the box, and it goes beyond purely
generative approaches by
providing an extensible intermediate representation that can be used to
implement
sophisticated domain-specific compiler pipelines.

At the same time LMS is hackable: since it is just a library, all aspects
can be
modified or extended to suit a particular purpose."

I wonder if ATS’s very expressive approach can support such a paradigm.
For a motivational example (motivation for me anyway) see:A SQL Query
Compiler http://scala-lms.github.io/tutorials/query.html. This
approach is used in LegoBase http://data.epfl.ch/legobase to very good
effect. I think it is very attractive if we can mix in relational
declarative programming this way with imperative programming that can
supply large amount of libraries and take care of side effects.


You received this message because you are subscribed to a topic in the
Google Groups “ats-lang-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ats-lang-users/vgjuDIMcXYI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com?utm_medium=email&utm_source=footer
.

I took a quick look at LMS.

I feel that the template system of ATS is already a kind of LMS.
Instead of using an intermediate representation, ATS uses a small set of
C and then relies on an optimizing C compiler to get efficient object code.
Compared to LMS, the template-based approach of ATS is more
direct and flexible.

I am not familiar with compiling query languages, though.On Sunday, February 8, 2015 at 2:20:23 PM UTC-5, H Zhang wrote:

LMS stands for Lightweight Modular Staging http://scala-lms.github.io/.
For a definitive guide see Tiark Rompf’s Ph.D. dissertation
http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without
Regret for High-Level High-Performance Programming
I am still studying it
but this seems like a very interesting approach to solve the expression
problem without sacrificing performance. Let me quote from the tutorial
page http://scala-lms.github.io/tutorials/index.html:

"Why Generative Programming ?

Because it enables abstraction without regret: the key idea is to write
very high-level
and generic programs that generate specialized and extremely fast
low-level code at runtime.

Programming abstractions that would usually be avoided in
performance-sensitive code
(objects, type classes, higher-order functions) can be used during
generation without
affecting performance of the generated code.

Why LMS ?

Because it is lightweight and modular: LMS is just a Scala library. With
types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).

LMS comes with batteries included: it provides many optimizations such as
common subexpression elimination out of the box, and it goes beyond purely
generative approaches by
providing an extensible intermediate representation that can be used to
implement
sophisticated domain-specific compiler pipelines.

At the same time LMS is hackable: since it is just a library, all aspects
can be
modified or extended to suit a particular purpose."

I wonder if ATS’s very expressive approach can support such a paradigm.
For a motivational example (motivation for me anyway) see:A SQL Query
Compiler http://scala-lms.github.io/tutorials/query.html. This approach
is used in LegoBase http://data.epfl.ch/legobase to very good effect. I
think it is very attractive if we can mix in relational declarative
programming this way with imperative programming that can supply large
amount of libraries and take care of side effects.

To put on the hat of a devil’s advocate:

Using LMS to generate efficient C code is incredibly hard; so LMS will
become more and more
complex; so people will find out later that writing efficient C code
directly is probably more cost-effective.On Sunday, February 8, 2015 at 6:20:54 PM UTC-5, H Zhang wrote:

Also I think one of the argument for LMS is that once code is transformed
into low level code (C for example) many optimization opportunities are
lost esp if one starts with high level representations (high order
functions, polymorphism e.g.), so their motto is “abstraction without
regret”. I don’t know how well that can be achieved but it certainly is a
very admirable goal.

On Sun, Feb 8, 2015 at 2:11 PM, gmhwxi <gmh...@gmail.com <javascript:>> wrote:

I took a quick look at LMS.

I feel that the template system of ATS is already a kind of LMS.
Instead of using an intermediate representation, ATS uses a small set of
C and then relies on an optimizing C compiler to get efficient object
code.
Compared to LMS, the template-based approach of ATS is more
direct and flexible.

I am not familiar with compiling query languages, though.

On Sunday, February 8, 2015 at 2:20:23 PM UTC-5, H Zhang wrote:

LMS stands for Lightweight Modular Staging http://scala-lms.github.io/.
For a definitive guide see Tiark Rompf’s Ph.D. dissertation
http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without
Regret for High-Level High-Performance Programming
I am still studying
it but this seems like a very interesting approach to solve the expression
problem without sacrificing performance. Let me quote from the tutorial
page http://scala-lms.github.io/tutorials/index.html:

"Why Generative Programming ?

Because it enables abstraction without regret: the key idea is to write
very high-level
and generic programs that generate specialized and extremely fast
low-level code at runtime.

Programming abstractions that would usually be avoided in
performance-sensitive code
(objects, type classes, higher-order functions) can be used during
generation without
affecting performance of the generated code.

Why LMS ?

Because it is lightweight and modular: LMS is just a Scala library. With
types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).

LMS comes with batteries included: it provides many optimizations such
as common subexpression elimination out of the box, and it goes beyond
purely generative approaches by
providing an extensible intermediate representation that can be used to
implement
sophisticated domain-specific compiler pipelines.

At the same time LMS is hackable: since it is just a library, all
aspects can be
modified or extended to suit a particular purpose."

I wonder if ATS’s very expressive approach can support such a paradigm.
For a motivational example (motivation for me anyway) see:A SQL Query
Compiler http://scala-lms.github.io/tutorials/query.html. This
approach is used in LegoBase http://data.epfl.ch/legobase to very
good effect. I think it is very attractive if we can mix in relational
declarative programming this way with imperative programming that can
supply large amount of libraries and take care of side effects.


You received this message because you are subscribed to a topic in the
Google Groups “ats-lang-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ats-lang-users/vgjuDIMcXYI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
ats-lang...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com?utm_medium=email&utm_source=footer
.

Also I think one of the argument for LMS is that once code is transformed
into low level code (C for example) many optimization opportunities are
lost esp if one starts with high level representations (high order
functions, polymorphism e.g.), so their motto is “abstraction without
regret”. I don’t know how well that can be achieved but it certainly is a
very admirable goal.On Sun, Feb 8, 2015 at 2:11 PM, gmhwxi gmh...@gmail.com wrote:

I took a quick look at LMS.

I feel that the template system of ATS is already a kind of LMS.
Instead of using an intermediate representation, ATS uses a small set of
C and then relies on an optimizing C compiler to get efficient object code.
Compared to LMS, the template-based approach of ATS is more
direct and flexible.

I am not familiar with compiling query languages, though.

On Sunday, February 8, 2015 at 2:20:23 PM UTC-5, H Zhang wrote:

LMS stands for Lightweight Modular Staging http://scala-lms.github.io/.
For a definitive guide see Tiark Rompf’s Ph.D. dissertation
http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without
Regret for High-Level High-Performance Programming
I am still studying
it but this seems like a very interesting approach to solve the expression
problem without sacrificing performance. Let me quote from the tutorial
page http://scala-lms.github.io/tutorials/index.html:

"Why Generative Programming ?

Because it enables abstraction without regret: the key idea is to write
very high-level
and generic programs that generate specialized and extremely fast
low-level code at runtime.

Programming abstractions that would usually be avoided in
performance-sensitive code
(objects, type classes, higher-order functions) can be used during
generation without
affecting performance of the generated code.

Why LMS ?

Because it is lightweight and modular: LMS is just a Scala library. With
types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).

LMS comes with batteries included: it provides many optimizations such as
common subexpression elimination out of the box, and it goes beyond purely
generative approaches by
providing an extensible intermediate representation that can be used to
implement
sophisticated domain-specific compiler pipelines.

At the same time LMS is hackable: since it is just a library, all aspects
can be
modified or extended to suit a particular purpose."

I wonder if ATS’s very expressive approach can support such a paradigm.
For a motivational example (motivation for me anyway) see:A SQL Query
Compiler http://scala-lms.github.io/tutorials/query.html. This
approach is used in LegoBase http://data.epfl.ch/legobase to very good
effect. I think it is very attractive if we can mix in relational
declarative programming this way with imperative programming that can
supply large amount of libraries and take care of side effects.


You received this message because you are subscribed to a topic in the
Google Groups “ats-lang-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ats-lang-users/vgjuDIMcXYI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com?utm_medium=email&utm_source=footer
.

Yes that is what I vaguely understood as well and why I asked the question
here. However a LMS program is a user defined specializer that generates
another program so you can start with a query string and end with a C
program (another string). The underlying virtualized Scala is used to
ensure type safety. LMS also provides facilities to rewrite the code using
the IR. How can one achieve the same with ATS? ATS itself is a code
transformer (at compile time) but can it also easily let users write a
domain specific transformer (at run time) on their own? Can ATS’s dependent
type system provide a better tool?On Sun, Feb 8, 2015 at 2:11 PM, gmhwxi gmh...@gmail.com wrote:

I took a quick look at LMS.

I feel that the template system of ATS is already a kind of LMS.
Instead of using an intermediate representation, ATS uses a small set of
C and then relies on an optimizing C compiler to get efficient object code.
Compared to LMS, the template-based approach of ATS is more
direct and flexible.

I am not familiar with compiling query languages, though.

On Sunday, February 8, 2015 at 2:20:23 PM UTC-5, H Zhang wrote:

LMS stands for Lightweight Modular Staging http://scala-lms.github.io/.
For a definitive guide see Tiark Rompf’s Ph.D. dissertation
http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without
Regret for High-Level High-Performance Programming
I am still studying
it but this seems like a very interesting approach to solve the expression
problem without sacrificing performance. Let me quote from the tutorial
page http://scala-lms.github.io/tutorials/index.html:

"Why Generative Programming ?

Because it enables abstraction without regret: the key idea is to write
very high-level
and generic programs that generate specialized and extremely fast
low-level code at runtime.

Programming abstractions that would usually be avoided in
performance-sensitive code
(objects, type classes, higher-order functions) can be used during
generation without
affecting performance of the generated code.

Why LMS ?

Because it is lightweight and modular: LMS is just a Scala library. With
types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).

LMS comes with batteries included: it provides many optimizations such as
common subexpression elimination out of the box, and it goes beyond purely
generative approaches by
providing an extensible intermediate representation that can be used to
implement
sophisticated domain-specific compiler pipelines.

At the same time LMS is hackable: since it is just a library, all aspects
can be
modified or extended to suit a particular purpose."

I wonder if ATS’s very expressive approach can support such a paradigm.
For a motivational example (motivation for me anyway) see:A SQL Query
Compiler http://scala-lms.github.io/tutorials/query.html. This
approach is used in LegoBase http://data.epfl.ch/legobase to very good
effect. I think it is very attractive if we can mix in relational
declarative programming this way with imperative programming that can
supply large amount of libraries and take care of side effects.


You received this message because you are subscribed to a topic in the
Google Groups “ats-lang-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ats-lang-users/vgjuDIMcXYI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/b3b30b9b-d081-4638-8a52-d62825990526%40googlegroups.com?utm_medium=email&utm_source=footer
.

Please compare the following example with the one at
http://scala-lms.github.io:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/ATS-QA-LIST/qa-list-2015-02-08.datsOn Sunday, February 8, 2015 at 5:11:56 PM UTC-5, gmhwxi wrote:

I took a quick look at LMS.

I feel that the template system of ATS is already a kind of LMS.
Instead of using an intermediate representation, ATS uses a small set of
C and then relies on an optimizing C compiler to get efficient object code.
Compared to LMS, the template-based approach of ATS is more
direct and flexible.

I am not familiar with compiling query languages, though.

On Sunday, February 8, 2015 at 2:20:23 PM UTC-5, H Zhang wrote:

LMS stands for Lightweight Modular Staging http://scala-lms.github.io/.
For a definitive guide see Tiark Rompf’s Ph.D. dissertation
http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without
Regret for High-Level High-Performance Programming
I am still studying
it but this seems like a very interesting approach to solve the expression
problem without sacrificing performance. Let me quote from the tutorial
page http://scala-lms.github.io/tutorials/index.html:

"Why Generative Programming ?

Because it enables abstraction without regret: the key idea is to write
very high-level
and generic programs that generate specialized and extremely fast
low-level code at runtime.

Programming abstractions that would usually be avoided in
performance-sensitive code
(objects, type classes, higher-order functions) can be used during
generation without
affecting performance of the generated code.

Why LMS ?

Because it is lightweight and modular: LMS is just a Scala library. With
types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).

LMS comes with batteries included: it provides many optimizations such as
common subexpression elimination out of the box, and it goes beyond purely
generative approaches by
providing an extensible intermediate representation that can be used to
implement
sophisticated domain-specific compiler pipelines.

At the same time LMS is hackable: since it is just a library, all aspects
can be
modified or extended to suit a particular purpose."

I wonder if ATS’s very expressive approach can support such a paradigm.
For a motivational example (motivation for me anyway) see:A SQL Query
Compiler http://scala-lms.github.io/tutorials/query.html. This
approach is used in LegoBase http://data.epfl.ch/legobase to very good
effect. I think it is very attractive if we can mix in relational
declarative programming this way with imperative programming that can
supply large amount of libraries and take care of side effects.