PageRenderTime 52ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/README.md

https://github.com/bartbes/Fetus
Markdown | 49 lines | 36 code | 13 blank | 0 comment | 0 complexity | a44924b38270bf1a8409457352742f5f MD5 | raw file
  1. #Fetus#
  2. Fetus is a VM for running Fetus bytecode, this is accompanied by the Fetus language, Fetoid, and their compilers. There is even an experimental, and probably horribly broken, Brainfuck compiler.
  3. ###The VM###
  4. The VM is a general purpose VM designed to run Fetus bytecode, this means it is not restricted to running just Fetus code, but it can run any compatible bytecode. It is designed with both a stack and (abstracted) memory access in mind, completely number-based. One of the features of this VM is providing high-level functions such as file I/O and sockets.
  5. ###Fetus language###
  6. The Fetus language is assembly like, but enforces strict rules on syntax.
  7. 1. Each command has a separate line
  8. 2. Every line consists of 2 parts, a command and an argument.
  9. 3. The command is an ascii string, usually 3 or 4 characters.
  10. 4. The argument consist of a 4-byte hexadecimal number, 0000 in case no argument is needed.
  11. 5. call is used to call functions.
  12. 6. Commands interact with the stack, and have stack effects.
  13. 7. Functions expect a proper stack set up and clear the stack during their operation.
  14. 8. Any lines not following these rules are ignored.
  15. These are the basics to get you started.
  16. The compiler is a very small and basic program, turning commands in their bytecode equivalents and stripping all unnecessary data. Generally code is first processed by the preprocessor, providing some advanced features, like strings, which are not natively supported by the language.
  17. ###Fetoid###
  18. Fetoid is a language that you can actually consider high-level, though it's primary unit is still numbers, and, of course, the underlying memory model stays the same. Coding in Fetoid is radically different from coding in the Fetus language.
  19. More documentation will hopefully be added later, but currently the language is too much in flux for documentation to be written.
  20. ###Letus###
  21. Oh yes, the name is horrible, and it will be changed. Sometime. I swear.
  22. What kind of language is it, you ask? Well, it's a language based on S-expressions. This means it's lisp-like in syntax, and I have, in fact borrowed a few things from scheme.
  23. ###Brainfuck###
  24. A simple brainfuck compiler is included, it *should* all work, but it has not been tested thoroughly. Because brainfuck has a very loose specification, it is very possible that existing (advanced) brainfuck code won't work.
  25. ###Executables###
  26. On first run, 'make all' should be executed to compile the VM, and the tools for the supported languages.
  27. * brainfuck - A script that compiles and runs a Brainfuck program.
  28. * brainfuck_c - The Brainfuck compiler.
  29. * fetoid - A script that compiles and runs a Fetoid program.
  30. * fetoid_c - The Fetoid compiler.
  31. * letus - A script that compiles and runs a Letus program.
  32. * letus_c - The Letus compiler.
  33. * fetus - A script that preprocesses, compiles and runs a Fetus language program.
  34. * fetus_c - The Fetus language compiler.
  35. * fetus_pp - The Fetus language preprocessor.
  36. * fetus_vm - The Fetus VM.