Bitcoin Forum
January 20, 2019, 06:12:46 PM *
News: Latest Bitcoin Core release: 0.17.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Script language grammar?  (Read 262 times)
Severos
Full Member
***
Offline Offline

Activity: 268
Merit: 116


View Profile
November 18, 2017, 04:08:43 PM
 #1

This wiki page contain pretty much helpful info: https://en.bitcoin.it/wiki/Script  since it has all the 'words' accepted in the scripting language.
However, I was wondering if there's something like a grammar to this language? something like the grammar used to build parse tree for other languages.

Reason I'm looking for this is that I have a project at university for the compilers course, so I was looking into building a parse tree for the bitcoin scripts.

Thanks in advance.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
2112
Legendary
*
Offline Offline

Activity: 2114
Merit: 1027



View Profile
November 18, 2017, 07:02:05 PM
 #2

The context-free grammar is trivial, just a concatenation of lexical elements (alphabet symbols). All the expressive power is contained in the context (in this case, the contents of the stacks). It is equivalent to a simple RPN (reverse-polish notation) calculator, it doesn't even use parentheses for disambiguating the order of operations.

Since you've mentioned "university course": the formal languages aren't a good tool to analyze simple stack machines like the one in Bitcoin. You would just waste time trying to analyze it at this level. Search for another, more productive, subject for your coursework.

Please comment, critique, criticize or ridicule BIP 2112: https://bitcointalk.org/index.php?topic=54382.0
Long-term mining prognosis: https://bitcointalk.org/index.php?topic=91101.0
Severos
Full Member
***
Offline Offline

Activity: 268
Merit: 116


View Profile
November 18, 2017, 07:54:33 PM
 #3

Thanks for your explanation, do you think it'll be worth trying to do it for the ethereum solidity language ??
2112
Legendary
*
Offline Offline

Activity: 2114
Merit: 1027



View Profile
November 18, 2017, 08:09:46 PM
 #4

Thanks for your explanation, do you think it'll be worth trying to do it for the ethereum solidity language ??
Yeah, with Solidity the context-free grammars are the proper tool-set to for the problem domain.

You'd really will have to discuss this with your scientific advisor at your school. They will need to help you select a project with the proper difficulty level for your school and your degree. My advice is: prepare a palette of possible projects, some too trivial (like your original idea), some too complex, and have have a discussion with the a teacher at your school who knows you and who will grade your coursework.

Please comment, critique, criticize or ridicule BIP 2112: https://bitcointalk.org/index.php?topic=54382.0
Long-term mining prognosis: https://bitcointalk.org/index.php?topic=91101.0
Pages: [1]
  Print  
 
Jump to:  

Bitcointalk.org is not available or authorized for sale. Do not believe any fake listings.
Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!