Forum has syntax highlight support for different languages
Posted: Sat Dec 18, 2021 2:12 pm
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.
Pascal:
BASIC:
C:
SharpBASIC:
NASM:
Below are "hello world" examples in Pascal, BASIC, C, SharpBASIC and NASM.
Pascal:
Code: Select all
program HelloWorld(output);
begin
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.}
end.
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 "sys.sbi";
main do
' print to standard output device (stdout)
print("Hello, World!");
end
Code: Select all
; Define variables in the data section
SECTION .DATA
hello: db 'Hello world!',10
helloLen: equ $-hello
; Code goes in the text section
SECTION .TEXT
GLOBAL _start
_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