emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/beardbolt 4679974da1 141/323: Add documentation and sta


From: ELPA Syncer
Subject: [elpa] externals/beardbolt 4679974da1 141/323: Add documentation and starter file for PHP support
Date: Thu, 9 Mar 2023 10:58:25 -0500 (EST)

branch: externals/beardbolt
commit 4679974da16370607dda5c79b48201a0aef8a82e
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>

    Add documentation and starter file for PHP support
---
 README.org           |  7 ++++++-
 rmsbolt.el           | 14 +++++++++++---
 starters/rmsbolt.php | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 4a9dde26cc..ddba8bda2f 100644
--- a/README.org
+++ b/README.org
@@ -11,7 +11,7 @@ versa. It supports more types of languages than any previous 
tool of its kind.
 
 - Much more flexible and powerful:
   - Supports disassembly to bytecode as well as assembly.
-  - Supports many languages that godbolt does not support, such as Python,
+  - Supports many languages that godbolt does not support, such as Python, PHP,
     Common Lisp, Emacs Lisp, Ocaml, Java, and Pony.
 - No more sending your code to any server.
 - Much faster turnaround time from writing code to seeing and interacting with 
disassembly.
@@ -127,6 +127,10 @@ moment.
 
 [[https://i.imgur.com/KkWEMMj.gif][https://i.imgur.com/KkWEMMj.gif]]
 
+** PHP
+Requires the [[https://github.com/derickr/vld][vld php extension]] to display 
PHP opcodes.
+
+[[https://i.imgur.com/xBfzaK9.gif][https://i.imgur.com/xBfzaK9.gif]]
 ** Pony
 
 Filtering on pony is not as effective as pony asm includes references to
@@ -206,5 +210,6 @@ mail with your patch. If your change is non-trivial, please
   - [[https://github.com/yawkat/javap][yawkat/javap]]
   - 
[[https://github.com/mattgodbolt/compiler-explorer][mattgodbolt/compiler-explorer]]
   - [[http://reliant.colab.duke.edu/c2mips/][c2mips]]
+  - [[https://3v4l.org/][3v4l]]
 
 Please let me know if you find other alternatives not mentioned!
diff --git a/rmsbolt.el b/rmsbolt.el
index 882d48fac0..cf05367e59 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -25,8 +25,8 @@
 ;; RMSBolt is a package to provide assembly or bytecode output for a source
 ;; code input file.
 ;;
-;; It currently supports: C/C++, OCaml, Haskell, Python, Java, Pony, Emacs 
Lisp,
-;; and (limited) Common Lisp.
+;; It currently supports: C/C++, OCaml, Haskell, Python, Java, PHP, Pony,
+;; Emacs Lisp, and (limited) Common Lisp.
 ;;
 ;; Adding support for more languages, if they have an easy manual compilation
 ;; path from source->assembly/bytecode with debug information, should be much
@@ -52,6 +52,10 @@
 ;; `rmsbolt-intel-x86': Toggle between intel and att syntax if supported.
 ;; `rmsbolt-demangle': Demangle the output, if supported.
 ;;
+;; For more advanced configuration (to the point where you can override almost
+;; all of RMSbolt yourself), you can set `rmsbolt-language-descriptor' with a
+;; replacement language spec.
+;;
 ;; Please see the readme at https://gitlab.com/jgkamat/rmsbolt for
 ;; more information!
 ;;
@@ -484,7 +488,10 @@ Return value is quoted for passing to the shell."
                 " "))))
 
 (cl-defun rmsbolt--php-compile-cmd (&key src-buffer)
-  "Process a compile command for PHP it needs to have the vld.so module on."
+  "Process a compile command for PHP.
+In order to disassemble opcdoes, we need to have the vld.so
+extension to php on.
+https://github.com/derickr/vld";
   (rmsbolt--with-files
    src-buffer
    (concat (buffer-local-value 'rmsbolt-command src-buffer)
@@ -1222,6 +1229,7 @@ Argument OVERRIDE-BUFFER use this buffer instead of 
reading from the output file
     ("rust " . "rmsbolt.rs")
     ("python" . "rmsbolt.py")
     ("haskell" . "rmsbolt.hs")
+    ("php" . "rmsbolt.php")
     ("pony" . "rmsbolt.pony")
     ("emacs-lisp" . "rmsbolt-starter.el")
     ;; Rmsbolt is capitalized here because of Java convention of Capitalized
diff --git a/starters/rmsbolt.php b/starters/rmsbolt.php
new file mode 100644
index 0000000000..dbed187c68
--- /dev/null
+++ b/starters/rmsbolt.php
@@ -0,0 +1,37 @@
+<?php
+
+/*
+  RMSBolt requires the 'vld.so' extension to php in order to display opcodes 
for PHP.
+  You can install it following instructions from here:
+  https://github.com/derickr/vld
+
+  Without this, you will get an empty buffer or an error.
+ */
+
+function isRMS($var) {
+       switch ($var) {
+       case 'R':
+       case 'M':
+       case 'S':
+               return true;
+       default:
+               return true;
+       }
+}
+
+
+function main() {
+       $a = 200;
+       foreach (range(1, 5) as $var) {
+               $a += $var;
+       }
+       $a = 82;
+       print(isRMS(chr($a)) ? "True\n" : "False\n");
+}
+
+main();
+
+// Local Variables:
+// rmsbolt-command: "php"
+// End:
+?>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]