How to Convert usual text to executable machine code in python

0 votes

I need to solve the task, connecting with creating of DSL. First, what should I do to translate text to machine code. For example:

text: 'If salary more than 5000 do op1'

should be translated to..

if salary > 5000:
    op1

Is any way to do it? Maybe it other langs

Oct 1, 2018 in Python by bug_seeker
• 15,310 points
31 views

1 answer to this question.

0 votes

what you are looking for is a compiler, Yacc & Flex using BISON GNU.

Yacc: Yacc wiki & BISON GNU Docs

But before going through that, you need to know about context free grammars.

Context Free Grammar

answered Oct 1, 2018 by Priyaj
• 56,160 points

Related Questions In Python

0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

answered Nov 12, 2018 in Python by Nymeria
• 3,500 points
3,602 views
0 votes
1 answer

How to correctly return an a dictionary as an output in zappier code using python?

David here, from the Zapier Platform team. ...READ MORE

answered Dec 3, 2018 in Python by charlie_brown
• 7,710 points
87 views
0 votes
0 answers

How to read lines from compressed text files in Python

Is it easy to read a line ...READ MORE

Dec 27, 2018 in Python by Anirudh
• 2,060 points
65 views
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 127 views
0 votes
1 answer

How to convert date string to date object in python?

Use this :-  >>> datetime.datetime.strptime('24052010 ...READ MORE

answered Oct 22, 2018 in Python by Priyaj
• 56,160 points
75 views
0 votes
1 answer

How to convert datetime.date to UTC timestamp in Python

In Python 3 (< 3.3) From the docs ...READ MORE

answered Oct 31, 2018 in Python by Priyaj
• 56,160 points
1,318 views