Page 1 of 1

Forum has syntax highlight support for different languages

Posted: Sat Dec 18, 2021 2:12 pm
by frank
The nice thing about syntax highlight support is that multiple languages can be supported. Prism supports a wide range of languages. By adding the language name to the code tag, the language tokens will be recognized. While this forum has default highlight support for SharpBASIC, adding e.g. "pascal" to the code tag (code=pascal) allows for nicely sharing Pascal code snippets.

Below are "hello world" examples in Pascal, BASIC, C, SharpBASIC and NASM.


Code: Select all

program HelloWorld(output);
    Write('Hello, World!')
    {No ";" is required after the last statement of a block -
        adding one adds a "null statement" to the program, which is ignored by the compiler.}

Code: Select all

print "Hello, World!"

sleep:end  rem Comment, prevents the program window from closing instantly

Code: Select all

#include <stdio.h>
int main() {
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;

Code: Select all

incl "";
main do
  ' print to standard output device (stdout)
  print("Hello, World!");

Code: Select all

; Define variables in the data section
	hello:     db 'Hello world!',10
	helloLen:  equ $-hello

; Code goes in the text section
	GLOBAL _start 

	mov eax,4            ; 'write' system call = 4
	mov ebx,1            ; file descriptor 1 = STDOUT
	mov ecx,hello        ; string to write
	mov edx,helloLen     ; length of string to write
	int 80h              ; call the kernel

	; Terminate program
	mov eax,1            ; 'exit' system call
	mov ebx,0            ; exit with error code 0
	int 80h              ; call the kernel

Re: Forum has syntax highlight support for different languages

Posted: Sat Feb 19, 2022 8:07 am
by frank
search engine test