Bitcoin Forum
May 07, 2024, 12:39:06 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Script language grammar?  (Read 377 times)
Severos (OP)
Full Member
***
Offline Offline

Activity: 268
Merit: 119


View Profile
November 18, 2017, 04:08:43 PM
Merited by ABCbits (1)
 #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.
1715042346
Hero Member
*
Offline Offline

Posts: 1715042346

View Profile Personal Message (Offline)

Ignore
1715042346
Reply with quote  #2

1715042346
Report to moderator
1715042346
Hero Member
*
Offline Offline

Posts: 1715042346

View Profile Personal Message (Offline)

Ignore
1715042346
Reply with quote  #2

1715042346
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715042346
Hero Member
*
Offline Offline

Posts: 1715042346

View Profile Personal Message (Offline)

Ignore
1715042346
Reply with quote  #2

1715042346
Report to moderator
1715042346
Hero Member
*
Offline Offline

Posts: 1715042346

View Profile Personal Message (Offline)

Ignore
1715042346
Reply with quote  #2

1715042346
Report to moderator
2112
Legendary
*
Offline Offline

Activity: 2128
Merit: 1065



View Profile
November 18, 2017, 07:02:05 PM
Merited by ABCbits (3)
 #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 (OP)
Full Member
***
Offline Offline

Activity: 268
Merit: 119


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: 2128
Merit: 1065



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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!