473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Grammar into Object Structure

Hello!

I want to transform the grammar for linear time logic (LTL) into an
C++ Object structure. More precisely:

I want some classes like this

class primary {

void operator(); // object is function object
}

class U {
void operator();
}

[...]

Some ltl formula such as "G (phi U psi)" should be represented using
the c++ objects like:

G( U(phi,psi) )
But I've no idea how to implement the structure elegant and efficient.
Any hints?

Rene
LTL-Grammar:

// primary:
// '(' impl-or-equiv ')'
// '1'
// '0'
// ID

// prefix:
// '!' prefix
// 'X' prefix
// 'F' prefix
// 'G' prefix
// primary

// until-or-release:
// prefix
// prefix 'U' prefix
// prefix 'V' prefix

// and:
// until-or-release { '&' until-or-release }*

// or:
// and { '|' and }*

// impl-or-equiv:
// or '->' or
// or '<->' or

// element:
// impl-or-equiv
Jul 22 '05 #1
1 1171
Rene Theisen wrote:
I want to transform the grammar for linear time logic (LTL) into an
C++ Object structure. More precisely:

I want some classes like this

class primary {

void operator(); // object is function object
void operator()();
} ;
class U {
void operator();
void operator()();
} ;
[...]

Some ltl formula such as "G (phi U psi)" should be represented using
the c++ objects like:

G( U(phi,psi) )
But I've no idea how to implement the structure elegant and efficient.
Any hints?


See chapter 6 "Expressions" in "The C++ Programming Language". There
is an example of expression parser there. Should give you an idea.

Search the web for expression parsers, reverse polish notation, etc.

V
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Peri | last post by:
I'm trying to create Python parser/interpreter using ANTLR. Reading grammar from language refference I found: or_expr::= xor_expr | or_expr "|" xor_expr For me it looks like infinite recursion....
1
by: Karalius, Joseph | last post by:
Can anyone explain what is happening here? I haven't found any useful info on Google yet. Thanks in advance. mmagnet:/home/jkaralius/src/zopeplone/Python-2.3.5 # make gcc -pthread -c...
0
by: Bengt Richter | last post by:
We have where syntax in combination with suite expression syntax (bear with me, I think a good synergy will emerge ;-) ...
0
by: Chad Whitacre | last post by:
Hey all, I've been playing around with the parser module, and based on the documentation I would expect all symbols in a parse tree to be part of the grammar. For example, I find this line in...
2
by: Peter Rilling | last post by:
I am written a program that will be used to parse the lexical syntax of code files. I would like to generalize the grammar logic so that I don't hardcode any specific grammar in my program. ...
3
by: junky_fellow | last post by:
I got one link to the ANSI C Grammar http://www.lysator.liu.se/c/ANSI-C-grammar-y.html However, I don't know how to understand this grammar. I am not a Computer Science Guy. Can anybody please...
14
by: Magius | last post by:
Hello, I have a question about the correctness of the language grammar for the C# 2.0 specification. I am working with the grammar specified in the June 2005 ECMA-334 standard. Basically, a...
2
by: Bhupesh Naik | last post by:
This is a query regarding my problem to make a spell and grammar check possible in text area of a web page. We have aspx pages which are used to construct letters. The browser based screens...
10
by: MBR | last post by:
Hello... I'm using the grammar at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_c.asp as a reference in creating my own C# parser using a custom...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.