1

I'm developing a program in assembly language using TASM with emu 8086 as a debugger. I'm almost finish with the project but I'm curious about one feature, is auto-suggest possible in this language? For example, I ask input by char, if it detects same char from the stored data, it will show that data.

If it is not possible, then I'll not push myself too hard. Thanks!

Update: I mean, I will use "auto-suggest" on my search function. Thus, when I input "cha" , it would suggest like "chat", "char", etc..

rosal.rw
  • 13
  • 5
  • when you're doing assembly, expect to have primitive tools :) – mukunda Nov 29 '14 at 21:45
  • 1
    @mukunda: Why? *Progress is made by the unreasonable man*. If you personally can analyze assembler in realtime to produce useful insights while you are editing it, it ought to be possible to build a tool to do the same thing. – Ira Baxter Nov 29 '14 at 23:30
  • 2
    "if it detects same char from the stored data, it will show that data". What is "it" here? The program you are writing? Or the text editor you are using to write the program? What is "the stored data"? – Raymond Chen Nov 29 '14 at 23:43
  • @IraBaxter Sure it's possible. It's very possible. But, assembly, especially x86 assembly, has little support – mukunda Nov 30 '14 at 01:20
  • @Raymond Chen. The "it" there was the stored data such as names, when you search, just with the prefix "ray" it would suggest "raymond" or "rayden". – rosal.rw Nov 30 '14 at 03:21
  • 1
    Yes, it is possible. ...but if you have to ask about the possibility, implementing it from scratch is probably beyond you right now. The way to do it though is just to search for the prefix in your database and draw out the best option you find (or a list of options). IMO the hardest part is actually displaying the options... and that isn't too hard either, but I wouldn't do it as an early project in assembly, you'd probably want some more experience, maybe implement an auto-suggest in a language like C first so you know the principle better. – Adam D. Ruppe Nov 30 '14 at 03:24
  • I don't think the "it" is the stored data. That means that your sentence is "If the stored data detects same char from the stored data, the stored data will show that data." From your description, the "it" is the text editor. You will have to see what extensibility mechanisms exist for your text editor, or write your own. – Raymond Chen Nov 30 '14 at 04:11
  • For [Vim](http://www.vim.org/download.php) text editor [YouCompleteMe](http://valloric.github.io/YouCompleteMe/) seems be a very useful autocomplete plugin and it seems that it can be configured to work for any programming language, including any assembly language. Some other Vim options are mentioned in this SO question: http://stackoverflow.com/questions/1115876/autocompletion-in-vim – nrz Dec 01 '14 at 10:58

1 Answers1

1

You should be able to autosuggest bits of the program based on what has been collected so far. (All IDEs with "suggestions" basically do this).

Using the syntax of the assembler, anyplace a partial code fragment exists, a "syntax error corrector" can propose bits to insert or delete to fix the syntax. Variations of this include completing an instruction mnemonic, especially based on frequency of static occurrence of instructions in code, or typical code orders (just coded a CMP? Pretty sure a jump conditional is next). You might also suggest or autofill the rest of an addressing mode; many start with an opening paren or bracket, and after an operand, must be closed with the corresponding paren.

You can also collect the set of identifiers in the program, and using spelling correcting techniques (suffix trees, levehstein distance), propose the rest of an identifier. (You have no idea how often I've wished for this in a 30,000 line assembler application I continue to maintain).

Now, these are all (natch!) great ideas. Whether they are in the scope of things you think you know how to do, or are willing to do, is another question entirely. What this is likely to take is a considerable set of machinery for parsing, collecting/correcting symbols, analyzing partial programs, etc.; this is pretty daunting to build. (I've been trying to do something like this for the last 20 years with modest success, see my bio for more details).

Ira Baxter
  • 88,629
  • 18
  • 158
  • 311