Questions tagged [qi]

Qi is a modern lisp-like functional programming language, which incorporates many ML-style features, and a very powerful (turing complete) type system.

From the homepage:

Qi is an award-winning functional programming language based on 20 years R&D that offers the advantages of pattern matching, λ calculus consistency, optional lazy evaluation and static type checking. It uses sequent calculus notation to define types, and has the most powerful type system of any existing functional language, including ML and Haskell. Qi includes an integrated fully functional Prolog and an inbuilt compiler-compiler. Qi is free for personal and educational use and runs under Common Lisp.

33 questions
3
votes
1 answer

boost::spirit::qi::parse --> No result

Consider the following code: namespace qi = boost::spirit::qi; typedef qi::rule< std::string::const_iterator > rule_type; rule_type value_rule = +qi::char_ - ( '[' | qi::eoi ); std::string input( "Hello World" ); std::string value0,…
Maik
  • 541
  • 4
  • 15
3
votes
2 answers

Implementing a XML translator using XML's EBNF

I'm contemplating the idea of implementing a XML translator using a compiler generator, based on the W3C's XML 1.1 spec, which includes a complete EBNF grammar. More precisely, I plan to use Qi-YACC because I want to learn this tool. It will be my…
Daniel Jomphe
  • 16,991
  • 5
  • 29
  • 30
2
votes
1 answer

Boost spirit parsing indended list of items

I need to parse something like (yaml): - from: src to: - target1 - target2 - from: src2 to: - target3 - target4 I tried something like (simplified pseudo) identifierRule = +alnum; fromToRule = lit("-") >> ( …
2
votes
1 answer

Troubles with own types in Qi

I've vainly tried to get the type declaration examples working with Clozure CL, e.g. the following: (datatype fruit if (element? F [apples pears oranges]) ______________________________________ F : fruit;) but the only output I get…
beyeran
  • 885
  • 1
  • 8
  • 26
2
votes
1 answer

How to parse a string in spirit and use it as return value

I need to parse a key value pair, where key itself is a fixed string lke 'cmd' in the example. Unfortunately qi::lit has no synthesized attribute and qi::char_ parses no fixed string. Following code does not compile. I would need that result.name ==…
SRoeber
  • 61
  • 1
2
votes
1 answer

boost spirit debug rule with locals

I fail to compile code in debug mode (code with BOOST_SPIRIT_DEBUG_NODE(my_rule)) when my_rule has some local variable of custom type. First version with rule qi::locals is OK Second version with rule qi::locals is…
mesnardo
  • 21
  • 1
2
votes
1 answer

How to parse number after finding some word

I want to parse undermentioned JSON and extract from it productionYear value auto data = { "cars" : [ { "name" : "BMW", "engine" : 3.0 }, { "name" : "Citroen", …
bladzio
  • 414
  • 3
  • 15
2
votes
1 answer

Boost::Spirit struggle with parsing a String

I'm trying to Parse a String with Boost::Spirit, but i just cannot get it to work. I have no experience with Boost::Spirit since today. The string is composed of commands separated by an ';'. The commands are "INC someInteger" "BOMB firstInteger…
David O.
  • 50
  • 7
2
votes
0 answers

rpm -qi not showing installed kernel version

My OL 6.5 server show below in "rpm -qi": Version : 2.6.32 Release : 431.el6 Source RPM: kernel-2.6.32-431.el6.src.rpm But "uname -a" shows below kernel version: Linux dmdroemoc01 3.8.13-16.2.1.el6uek.x86_64 #1 SMP Thu Nov 7 17:01:44 PST…
Arun Krishnan
  • 161
  • 3
  • 8
2
votes
1 answer

How to write a boost::spirit::qi parser to do what '?' does in regex?

Let's say we have a regex "start:(?: ([0-9]{1,2}))? ([0-9].*)". It will match std::string string1 = "start: 01 0ab"; and std::string string2 = "start: 0ab"; We can also get the 2 matched string respectively. I try to use boost::spirit::qi parser…
wanghan02
  • 1,227
  • 7
  • 14
2
votes
0 answers

boost::spirit::qi grammar for parsing structured text file

a) So far this is my revised full code. It is not running fully as i am having errors such as "error: no type named 'type' in 'struct boost::spirit::traits::container_value" #include #include…
Kofi
  • 43
  • 7
2
votes
1 answer

Boost Spirit Qi, I have a parser that I would like to map onto a struct "dynamically" (meaning order of parameters is not fixed)

So I'm trying hard to get boost::spirit::qi under my skin. My toy example so far is a parser that parses Wavefront OBJ material libraries that have the following format: newmtl ShortBox Ka 0.6 0.6 0.6 Kd 0.5 0.5 0.5 Ks 0 0 0 d 1 Ns 0 illum…
Sheph
  • 625
  • 1
  • 6
  • 19
2
votes
1 answer

Unable to parse SQL type where condition using boost::spirit::qi

I may be asking a very trivial question but am not getting blocks out of my brain to crack it. Trying to parse a SQL like where clause as shown below using boost::spirit::qi to generate a vector of pairs std::string input = "book.author_id = '1234'…
Vivek S
  • 47
  • 7
2
votes
1 answer

How to extract trimmed text using Boost Spirit?

Using boost spirit, I'd like to extract a string that is followed by some data in parentheses. The relevant string is separated by a space from the opening parenthesis. Unfortunately, the string itself may contain spaces. I'm looking for a concise…
1
vote
2 answers

Using semantic actions (or another method) to operate on parsed value and return new value

I am using boost::spirit::qi to parse a number that can be optionally followed by metric prefixes. For example, "10k" for 10000. The k should be treated in a case insensitive fashion. I can simply match the prefix using: #include…
user3814483
  • 292
  • 1
  • 2
  • 13
1
2 3