Search in sources :

Example 1 with OSTask

use of priv.bajdcc.LALR1.interpret.os.kern.OSTask in project jMiniLang by bajdcc.

the class UIMainFrame method startOS.

private void startOS(UIGraphics g) {
    IOSCodePage[] pages = new IOSCodePage[] { // OS
    new OSEntry(), new OSIrq(), new OSTask(), // IRQ
    new IRPrint(), new IRRemote(), new IRTask(), new IRSignal(), // TASK
    new TKSystem(), new TKUtil(), new TKUI(), new TKNet(), // UI
    new UIMain(), new UIClock(), new UIHitokoto(), new UIMonitor(), // USER
    new UserMain(), // USER ROUTINE
    new URShell(), new UREcho(), new URPipe(), new URDup(), new URGrep(), new URRange(), new URProc(), new URTask(), new URSleep(), new URTime(), new URCount(), new URTest(), new URMsg(), new URNews(), new URBash(), new URReplace(), new URUtil(), new URAI(), // USER FILE
    new URFileLoad(), new URFileSave(), new URFileAppend() };
    try {
        String code = "import \"sys.base\";\n" + "import \"sys.proc\";\n" + "call g_load_sync_x(\"/kern/entry\");\n";
        interpreter = new Interpreter();
        for (IOSCodePage page : pages) {
            interpreter.load(page);
        }
        Grammar grammar = new Grammar(code);
        // System.out.println(grammar.toString());
        RuntimeCodePage page = grammar.getCodePage();
        // System.out.println(page.toString());
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        RuntimeCodePage.exportFromStream(page, baos);
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        interpreter.run("@main", bais);
    } catch (RegexException e) {
        System.err.println();
        System.err.println(e.getPosition() + "," + e.getMessage());
        e.printStackTrace();
    } catch (SyntaxException e) {
        System.err.println();
        System.err.println(String.format("模块名:%s. 位置:%s. 错误:%s-%s(%s:%d)", e.getPageName(), e.getPosition(), e.getMessage(), e.getInfo(), e.getFileName(), e.getPosition().iLine + 1));
        e.printStackTrace();
    } catch (RuntimeException e) {
        System.err.println();
        System.err.println(e.getkError().getMessage() + " " + e.getPosition() + ": " + e.getInfo());
        e.printStackTrace();
    } catch (Exception e) {
        System.err.println();
        System.err.println(e.getMessage());
        e.printStackTrace();
    }
}
Also used : OSTask(priv.bajdcc.LALR1.interpret.os.kern.OSTask) IOSCodePage(priv.bajdcc.LALR1.interpret.os.IOSCodePage) URFileSave(priv.bajdcc.LALR1.interpret.os.user.routine.file.URFileSave) SyntaxException(priv.bajdcc.LALR1.syntax.handler.SyntaxException) UIHitokoto(priv.bajdcc.LALR1.interpret.os.ui.UIHitokoto) UserMain(priv.bajdcc.LALR1.interpret.os.user.UserMain) URFileAppend(priv.bajdcc.LALR1.interpret.os.user.routine.file.URFileAppend) IRPrint(priv.bajdcc.LALR1.interpret.os.irq.IRPrint) ByteArrayInputStream(java.io.ByteArrayInputStream) TKUtil(priv.bajdcc.LALR1.interpret.os.task.TKUtil) UIClock(priv.bajdcc.LALR1.interpret.os.ui.UIClock) IRSignal(priv.bajdcc.LALR1.interpret.os.irq.IRSignal) OSEntry(priv.bajdcc.LALR1.interpret.os.kern.OSEntry) TKSystem(priv.bajdcc.LALR1.interpret.os.task.TKSystem) RuntimeException(priv.bajdcc.LALR1.grammar.runtime.RuntimeException) UIMain(priv.bajdcc.LALR1.interpret.os.ui.UIMain) Interpreter(priv.bajdcc.LALR1.interpret.Interpreter) OSIrq(priv.bajdcc.LALR1.interpret.os.kern.OSIrq) TKNet(priv.bajdcc.LALR1.interpret.os.task.TKNet) IRRemote(priv.bajdcc.LALR1.interpret.os.irq.IRRemote) Grammar(priv.bajdcc.LALR1.grammar.Grammar) RuntimeCodePage(priv.bajdcc.LALR1.grammar.runtime.RuntimeCodePage) ByteArrayOutputStream(java.io.ByteArrayOutputStream) TKUI(priv.bajdcc.LALR1.interpret.os.task.TKUI) SyntaxException(priv.bajdcc.LALR1.syntax.handler.SyntaxException) RuntimeException(priv.bajdcc.LALR1.grammar.runtime.RuntimeException) RegexException(priv.bajdcc.util.lexer.error.RegexException) UIMonitor(priv.bajdcc.LALR1.interpret.os.ui.UIMonitor) IRTask(priv.bajdcc.LALR1.interpret.os.irq.IRTask) URFileLoad(priv.bajdcc.LALR1.interpret.os.user.routine.file.URFileLoad) RegexException(priv.bajdcc.util.lexer.error.RegexException)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Grammar (priv.bajdcc.LALR1.grammar.Grammar)1 RuntimeCodePage (priv.bajdcc.LALR1.grammar.runtime.RuntimeCodePage)1 RuntimeException (priv.bajdcc.LALR1.grammar.runtime.RuntimeException)1 Interpreter (priv.bajdcc.LALR1.interpret.Interpreter)1 IOSCodePage (priv.bajdcc.LALR1.interpret.os.IOSCodePage)1 IRPrint (priv.bajdcc.LALR1.interpret.os.irq.IRPrint)1 IRRemote (priv.bajdcc.LALR1.interpret.os.irq.IRRemote)1 IRSignal (priv.bajdcc.LALR1.interpret.os.irq.IRSignal)1 IRTask (priv.bajdcc.LALR1.interpret.os.irq.IRTask)1 OSEntry (priv.bajdcc.LALR1.interpret.os.kern.OSEntry)1 OSIrq (priv.bajdcc.LALR1.interpret.os.kern.OSIrq)1 OSTask (priv.bajdcc.LALR1.interpret.os.kern.OSTask)1 TKNet (priv.bajdcc.LALR1.interpret.os.task.TKNet)1 TKSystem (priv.bajdcc.LALR1.interpret.os.task.TKSystem)1 TKUI (priv.bajdcc.LALR1.interpret.os.task.TKUI)1 TKUtil (priv.bajdcc.LALR1.interpret.os.task.TKUtil)1 UIClock (priv.bajdcc.LALR1.interpret.os.ui.UIClock)1 UIHitokoto (priv.bajdcc.LALR1.interpret.os.ui.UIHitokoto)1