I am writing a scala editor and would like to leverage ctags for method and variable lookups. A quick search on internet indicates that this may have been done before, but can not locate how.
Ideally, i would like to leverage it in conjunction with something like Exuberant Ctags but it would be great if there was something that was platform independent (Exuberant Ctags seems to be based on C ).
any help on this would be appreciated.
or should I just use apache lucene ?
There's no such thing as "platform independent". Java requires the java executable, which is written in C. Same thing for Python, Ruby, Perl, etc. So, as long as there is an exuberant-ctags available, why bother with anything else?
EDIT
The link I originally had here, about Scala ctags and vim tagbar, is no longer valid. I thought of replacing it with something else, but googling for "scala ctags" or "scala tagbar" yield lots of stuff, and will remain up-to-date.
Exuberant Ctags supports far more than just C:
$ ctags --list-languages
Ant
Asm
Asp
Awk
Basic
BETA
C
C++
C#
Cobol
DosBatch
Eiffel
Erlang
Flex
Fortran
HTML
Java
JavaScript
Lisp
Lua
Make
MatLab
ObjectiveC
OCaml
Pascal
Perl
PHP
Python
REXX
Ruby
Scheme
Sh
SLang
SML
SQL
Tcl
Tex
Vera
Verilog
VHDL
Vim
YACC
$
Perhaps extending the Java language recognizer for Scala would be a good start?
Exuberant Ctags runs on Windows 98/NT/2000/XP, VMS, and (almost every?) Unix and Unix clone. I couldn't find a list of platforms where Exuberant Ctags doesn't run, anyway...
Related
I have written a plugin for vanilla lua. I wish to protect this plugin, and I have heard of obfuscation. I tried XFuscator, but even after fixing line 5's logic, it doesnt work. Are there any newer, better ones floating out there?
Thanks!
If you are going to run your Lua script in the same machine you build it (I mean, same Lua version, same machine architecture), you could just compile it to bytecode using luac like this:
luac -s -o example.out example.lua
And distribute the .out file, that doesn't contain the Lua source code.
Note that Lua bytecode is platform specific (endianness, word size), and it could change in future Lua versions (in fact it already did in the past). For that reason, if you compile it, let's say, in a Intel x86-64 with Lua 5.3, you should run your generated .out only in this kind of machines or compatible ones.
I am using Crimson Editor as a text editor and I think it suports only Active Perl as a compiler. I downloaded some new CPAN modules for emailing etc etc. I added them in Perl library but program still doesn't recognize those modules. Can you please help me? Is Active Perl doesn't support any extra modules? If so, what do you suggest me for Perl compiler?
Is Active Perl doesnt support any extra modules?
It does, but it has its own way of doing it called PPM. Because many Perl modules require Unix tools and a C compiler, these are pre-built for you. Unfortunately these packages are often well behind CPAN release and are often missing CPAN modules altogether.
If so, what do you suggest me for Perl compiler?
On Windows, I'd recommend using Strawberry Perl. It comes with a full environment necessary for building and installing Perl modules, including a C compiler. Then you can install things using the normal CPAN tools like cpan or cpanm.
I am using Chrimson Editor
It doesn't look like that editor has been updated in over 10 years, and it's very Windows specific. I'd suggest an editor like Sublime Text. It's cross-platform, so you're not stuck with a Windows-specific editor, it has good Perl support, and it's kept up to date.
I would also not get too attached to relying on your IDE to do all your compiling and running of code for you. If you do, you're limited to what your IDE supports, and your IDE can get in the way of understanding your tools. Instead, I'd suggest getting used to using the tools directly. Learn how to use Perl on the command line rather than via the IDE.
I have a very big Perl module, and I am expecting to call it in my Visual C++ project. I know there are tools like perl2exe and pp that can convert Perl modules to standalone executables (abc.exe).
I don't like the standalone executable because it makes the interface very complex. I have to call the Perl module by creating a process and communicating with it using standard input/output.
It will be much easier if the Perl module is a C/C++ static library. Just link it and call a function!
Thanks in advance!
You can't (yet|easily) compile modules. Instead, embed the Perl interpreter as a library.
You can indeed statically link your module into your C project. The thing to realise is that you need to link in perl too. perl is a library heavily used by Perl code (and it would be so even if Perl code could be compiled to machine language).
perlembed documents how to do this.
(David James both wrote the question and an answer. I'll edit it to conform to Stackoverflow standards.)
Using SBCL you can compile Lisp code to machine code.
Like Java, .net, C++ and even C you will need the runtime. So there are two ways to compile Common Lisp code.
First is to make huge binaries which is explained in SBCL documentation. No SBCL needed on target machine.
The other way is a more flexible one, which is to create machine code in a fasl (FASt Load) format. The SBCL runtime is needed on the target machine.
How does the second way work under a Unix-like operating system?
(Answer by David James:)
We are going to make two commands in our system: one for batch compiling Lisp code and the other for easily running Lisp code:
Using your favorite editor, open a file called sbcl.compile. The content should be:
#!/bin/bash
sbcl --noinform --eval "(compile-file \"$1\")" --eval "(quit)" > /dev/null
Now to compile Lisp files use:
# sbcl.compile hello.lisp
This will create a hello.fasl file.
Now to easily run these files, we create a new command. Using your favorite editor open a file called sbcl.run. The content should be:
#!/bin/bash
sbcl --noinform --load "$1" --quit --end-toplevel-options "$#"
Now you may invoke sbcl.run hello.fasl to run the native code.
# sbcl.run hello.fasl
Details are described in the SBCL manual: Starting SBCL
Another option is to add to the runtime all packages/functions/frameworks that you commonly use, and then save this state as a new core file, and use this as your default core while continuing development. I usually find fasls more trouble than they are worth, especially since lisp has the ability to save state in a VM-style core file. I just incrementally update the core as development moves along. And rebuild/update the core using GNU Make.
Used as a scripting language, does Scala have some sort of include directive, or is there a way to launch a script from an other script ?
The scala command has the :load filename command to load a Scala file interactively. Alternatively the scala command's -i filename argument can be used to preload the file.
As of beginning of 2013, there seems to be no built-in support for multiple-file scripts.
There's one guy that implemented #include support for non-interactive scala scripts, by assembling and compiling the files in a prior stage (have not tried it yet).
Here is the blog post about it:
http://www.crosson.org/2012/01/simplifying-scala-scripts-adding.html
And the git repository:
https://github.com/dacr/bootstrap
I hope this, or something along the lines, get official some day, since the -i filename scala switch seems to apply only for the interactive console.
Until then a proper scripting language, like Ruby, might still remain the best option.
Ammonite is an option. It implements scala (plus extensions) including import in scripts.