Re: [ANN] mixfix syntax for clojure 0.2.0

2015-09-24 Thread Vitaliy Vlasov
Thank you for an awesome library! Just a couple of days ago i've posted a 
question (https://groups.google.com/forum/#!topic/clojure/AVqx5Tbn8K8) and 
it was recommended to me. A miraculous coincidence:)

Vitaliy.

On Monday, September 14, 2015 at 8:40:55 PM UTC+3, Vitaliy Akimov wrote:
>
> The main change in the release is cljs support and also ns is changed to 
> more appropriate.
>
> And here is a reminder about what the library does. It simply adds mixfix 
> operators into the language without preprocessing and changing language 
> itself. So using the library you can write clojure expressions like this:
>
>
> (defn myfun [x y] 
>(if x < 2 then x + y - 1 else (x + y) * 2))
>
>
> And also develop richer syntax EDSLs like this:
>
>
> (exec (select * from table1, table2 where col1 < col2 group by col1, col2
> ))
>  
>
> The syntax is defined using following simple directives (which are in fact 
> just macro invocations):
>
>
> (m/op 400 + [[] + [+]])
> (m/op 400 - [[] - [+]])
> (m/op 500 * [[] * [+]])
> (m/op 500 / [[] / [+]])
> (m/op 400 < [[] < []])
>
> (m/op 100 if [if [+] then []])
> (m/op 110 if [if [+] then [] else []])
>
>
>
>
> It specifies precedence, symbol to be used as a head of application in 
> result, and a pattern to be used for parsing.
>
> For more details check project's github home: 
> https://github.com/awto/mixfix-clj
>
> Regards, Vitaliy
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Primitive pseudocode parser in Clojure

2015-09-23 Thread Vitaliy Vlasov
This looks awesome! Thanks so much! I'm actually extending it with some 
additional statements of my own (Instaparse would be perhaps too general in 
my case)

On Tuesday, September 22, 2015 at 2:08:03 AM UTC+3, Matching Socks wrote:
>
> Vitaliy Akimov described an approach to a similar problem here recently...
>
> https://groups.google.com/d/msg/clojure/HNH66_KNaNM/BjpJGnl7AgAJ
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Primitive pseudocode parser in Clojure

2015-09-21 Thread Vitaliy Vlasov
Hi all,

I'm happy to write my first post here:) I am writing a mathematical formula 
parser in Clojure. The formulas need to be written in infix notation and 
also support some primitive conditional statements (e.g. if-else and case), 
so that for instance this string would be parsed into a valid Clojure 
function definition:

if cond-value1
  v1 * v2 - v3
else
  v4 ** 2

The infix part turned out to be very easy thanks to Incanter's infix module 
(i use eval and Incanters' $=). So right now the system supports formulas 
without conditionals.

But I'm not sure on how to proceed with the conditional statements parser. 
Does a generalised approach/library exist on how to approach these kinds of 
problems? If not, i will implement my own of course.

Thank you!

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.