New ideas.

2008年12月19日星期五

Virtual Machine on Bios for Booting

I think out a new idea or new concept of Virtual Machine on BIOS(VMB) for Booting. Now we can use boot loader tools such as Grub to boot from a floppy disk image file, but this method doesn't work for a live CD image file or a USBDisk image file, because the boot programs on these disks will clear the memory and don't know they are booting from a virtual device. So we need a true virtual machine working on BIOS.

Here are the cool usages of VMBB:
1)Install OS from or run live OS from CD image file, no need to burn the image file to a real disk.
2)Install OS to a RamDisk(virtual disk in memory) and run OS in memory which is much more faster than on hard disk. The RamDisk image file can be saved to disk and loaded directly to memory on the next boot.
3)Boot from network using a CD image file or Ramdisk image file thus enables a diskless system. The applications or games can be installed to a virtual hard disk which assign storage on a network shared disk.
  没有英汉互译结果
  请尝试网页搜索

2008年4月6日星期日

Parser Grammar in EBNF


Program -> ModuleDef ... +> Program

ModuleDef -> module Qualident where [Import] [ModuleMember ...] end module +> ModuleDef

Import -> import Qualident /','... ';' +> Import

ModuleMember -> TypeMember
-> TypeClassDef

TypeClassDef -> TypeDef
-> ClassDef

TypeMember -> Constant
-> Variable
-> Accessor
-> Function
-> Constructor

Attribute -> '[' ']' +> Attribute
Attributes -> Attribute... +> Attributes

Constant -> [Attributes] def [':' TypeExpr] '=' Expr ';' +> Constant

Variable -> [Attributes] var ':' TypeExpr [ '=' Expr ] ';' +> Variable

Accessor -> [Attributes] def ':' TypeExpr where get CodeBlock [set CodeBlock] end def +> Accessor
-> [Attributes] def '[' Fields ']' ':' TypeExpr where get CodeBlock [set CodeBlock] end def +> Accessor

Function -> [Attributes] def [TypeParams] ':' FunctionType ';' +> Function
-> [Attributes] def [TypeParams] ':' FunctionType where CodeBlock end def +> Function
-> [Attributes] def '(' ')' ':' FunctionType ';' +> Operator
-> [Attributes] def '(' ')' ':' FunctionType where CodeBlock end def +> Operator

Constructor -> [Attributes] def [TypeParams] TupleType ';' +> Constructor
-> [Attributes] def [TypeParams] TupleType where CodeBlock end def +> Constructor

TypeDef -> [Attributes] type '=' '{' /','... '}' ';' +> EnumType
-> [Attributes] type [TypeParams]'=' TypeExpr [TypeClass] ';' +> TypeDef
-> [Attributes] type [TypeParams]['=' TypeExpr] [TypeClass] where [TypeMember ...] end type +> TypeDef

ClassDef -> [Attributes] class [TypeParams] [extend ] where [TypeMember ...] end class +> ClassDef

TypeParams -> '{' /','...'}' +> TypeParams

TypeArgs -> '{'TypeExpr /','...'}' +> TypeArgs

TypeClass -> belongto /','... +> TypeClass

TypeExpr -> +> AtomType
-> TupleType
-> GenericType
-> FunctionType
-> TypeExpr '' TypeExpr +> UnionType

TupleType -> '(' [Fields] ')' +> TupleType

GenericType -> TypeArgs +> GenericType

Fields -> FieldType / ','... +> Fields

FieldType -> ':' TypeExpr +> FieldType

FunctionType -> TupleType '->' TupleType +> FunctionType

CodeBlock -> [Statement ...] +> CodeBlock

Statement -> SimpleStmt
-> CompoundStmt

SimpleStmt -> LocalVar
-> Assignment
-> MultiAssignment
-> CallFunction
-> ReturnStmt
-> PassStmt
-> ExitStmt
-> NextStmt
-> UntilStmt

LocalVar -> var [':' TypeExpr] '=' Expr ';' +> LocalVar

Assignment -> Assignable '=' Expr ';' +> Assignment

MultiAssignment ~> '(' Assignable/','... ')' '=' Expr ';' +> MultiAssignment

CallFunction -> FunctionCall ';' +> CallFunction

ReturnStmt -> return ';' +> ReturnStmt
PassStmt -> pass ';' +> PassStmt
ExitStmt -> exit ';' +> ExitStmt
NextStmt -> next ';' +> NextStmt

UntilStmt -> until BoolExpr ';' +> UntilStmt

CompoundStmt -> If_Stmt
-> Case_Stmt
-> For_Stmt
-> While_Stmt
-> Repeat_Stmt

If_Stmt -> if BoolExpr then CodeBlock [Elif_Blocks] [else CodeBlock] end if +> If_Stmt

Elif_Blocks -> Elif_Block... +> Elif_Blocks

Elif_Block -> elif BoolExpr then CodeBlock +> Elif_Block

Case_Stmt -> case Primary of Case_Branches [others then CodeBlock] end case +> Case_Stmt

Case_Branches -> Case_Branch... +> Case_Branches
Case_Branch -> ExprList then CodeBlock +> Case_Branch

For_Stmt -> for in Primary do CodeBlock end for +> For_Stmt

While_Stmt -> while BoolExpr do CodeBlock end while +> While_Stmt

Repeat_Stmt -> repeat [Expr times] CodeBlock end repeat +> Repeat_Stmt

BoolExpr -> Expr +> BoolExpr

Expr -> Primary
-> UnaryExpr
-> BinaryExpr
-> ConditionalExpr
-> Expr and Expr +> And
-> Expr or Expr +> Or
-> Expr xor Expr +> Xor
-> not Expr +> Not

UnaryExpr -> [] Primary +> UnaryExpr
BinaryExpr -> UnaryExpr BinaryTerm... +> BinaryExpr
BinaryTerm -> Primary +> BinaryTerm

ConditionalExpr -> if BoolExpr then Expr else Expr +> ConditionalExpr

Primary -> Literal
-> List
-> Assignable
-> FunctionCall
-> '(' Expr ')'

Literal -> +> Num
-> true +> True
-> false +> False

List -> '[' [ExprList] ']' +> List

Assignable -> Ident
-> MemberAccess
-> ElementAccess

FunctionCall -> Primary [TypeArgs] '(' [ExprList] ')' +> FunctionCall
MemberAccess -> Primary '.' +> MemberAccess
ElementAccess-> Primary '[' ExprList ']' +> ElementAccess

ExprList -> Expr / ','... +> ExprList

Ident -> +> Ident

Qualident -> /'.' ... +> Qualident

Lexer Grammar in EBNF


TokenList
-> Token
-> TokenList Token
Token
-> Number +> num
-> Ident +> ident
-> Operator +> oper
-> Blank
$Digit -> "0123456789"
$Letter -> "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
Space -> " \r\n"
$Ident
-> Letter
-> Ident Letter
-> Ident Digit
$Number -> Digit... [ '.' Digit...]
$Operator -> '+' '-' '*' '/' '^' '<' '>' '<=' '>=' '==' '!='
Blank
-> Space
-> Blank Space

My Introduction

Shanghai, China
Software Developer. Mainly work in C#.